Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2-rc1 #463

Merged
merged 6 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
node_modules/
.DS_Store
.idea/

# Generated files
/dist/
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
If you need to save really large files bigger then the blob's size limitation or don't have
If you need to save really large files bigger then the blob's size limitation or don't have
enough RAM, then have a look at the more advanced [StreamSaver.js](https://github.com/jimmywarting/StreamSaver.js)
that can save data directly to the hard drive asynchronously with the power of the new streams API. That will have
support for progress, cancelation and knowing when it's done writing
Expand Down Expand Up @@ -58,16 +58,16 @@ saveAs must be run within a user interaction event such as onTouchDown or onClic

Syntax
------
### Import saveAs() from file-saver
### Import saveAs() from file-saver
```js
import { saveAs } from 'file-saver/FileSaver';
```

```js
FileSaver saveAs(Blob/File data, optional DOMString filename, optional Boolean disableAutoBOM)
FileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Boolean autoBOM)
```

Pass `true` for `disableAutoBOM` if you don't want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)).
Pass `true` for `autoBOM` if you don't want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)).

Examples
--------
Expand All @@ -86,6 +86,16 @@ var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, "hello world.txt");
```

### Saving urls

```js
FileSaver.saveAs("https://httpbin.org/image", "image.jpg");
```
Using urls within the same origin will just use `a[download]`
Otherwise it will first check if it supports cors header with a synchronously head request
if it dose it will download the data and save it using blob urls
if not it will try to download it using `a[download]`

The standard W3C File API [`Blob`][4] interface is not available in all browsers.
[Blob.js][5] is a cross-browser `Blob` implementation that solves this.

Expand Down
5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "file-saver",
"main": "dist/FileSaver.js",
"version": "1.3.8",
"main": "dist/FileSaver.min.js",
"version": "2.0.0-rc.1",
"homepage": "https://github.com/eligrey/FileSaver.js",
"authors": [
"Eli Grey <me@eligrey.com>"
Expand All @@ -16,6 +16,7 @@
"ignore": [
"*",
"!FileSaver.*js",
"!FileSaver.*map",
"!LICENSE.md"
]
}
50 changes: 0 additions & 50 deletions demo/demo.css

This file was deleted.

216 changes: 0 additions & 216 deletions demo/demo.js

This file was deleted.

2 changes: 0 additions & 2 deletions demo/demo.min.js

This file was deleted.

Loading