1.3.0
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* FileSaver.js
|
/* FileSaver.js
|
||||||
* A saveAs() FileSaver implementation.
|
* A saveAs() FileSaver implementation.
|
||||||
* 1.2.2
|
* 1.3.0
|
||||||
*
|
*
|
||||||
* By Eli Grey, http://eligrey.com
|
* By Eli Grey, http://eligrey.com
|
||||||
* License: MIT
|
* License: MIT
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Syntax
|
|||||||
------
|
------
|
||||||
|
|
||||||
```js
|
```js
|
||||||
FileSaver saveAs(Blob data, DOMString filename, optional Boolean disableAutoBOM)
|
FileSaver saveAs(Blob/File data, optional DOMString filename, optional Boolean disableAutoBOM)
|
||||||
```
|
```
|
||||||
|
|
||||||
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 `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)).
|
||||||
@@ -82,6 +82,18 @@ canvas.toBlob(function(blob) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Saving File
|
||||||
|
|
||||||
|
You can save a File constructor without specifying a filename. The
|
||||||
|
File itself already contains a name, There is a hand full of ways to get a file
|
||||||
|
instance (from storage, file input, new constructor)
|
||||||
|
But if you still want to change the name, then you can change it in the 2nd argument
|
||||||
|
|
||||||
|
```js
|
||||||
|
var file = new File(["Hello, world!"], "hello world.txt", {type: "text/plain;charset=utf-8"});
|
||||||
|
saveAs(file);
|
||||||
|
```
|
||||||
|
|
||||||
Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.
|
Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.
|
||||||
[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.
|
[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "file-saver",
|
"name": "file-saver",
|
||||||
"main": "FileSaver.js",
|
"main": "FileSaver.js",
|
||||||
"version": "1.2.2",
|
"version": "1.3.0",
|
||||||
"homepage": "https://github.com/eligrey/FileSaver.js",
|
"homepage": "https://github.com/eligrey/FileSaver.js",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Eli Grey <[email protected]>"
|
"Eli Grey <[email protected]>"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "file-saver",
|
"name": "file-saver",
|
||||||
"version": "1.2.2",
|
"version": "1.3.0",
|
||||||
"description": "An HTML5 saveAs() FileSaver implementation",
|
"description": "An HTML5 saveAs() FileSaver implementation",
|
||||||
"main": "FileSaver.js",
|
"main": "FileSaver.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user