From 3eeddf11459770171052540e10942ed467951906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 31 May 2016 09:30:32 +0200 Subject: [PATCH] 1.3.0 --- FileSaver.js | 2 +- README.md | 14 +++++++++++++- bower.json | 2 +- package.json | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/FileSaver.js b/FileSaver.js index 933008c..6a3cfc0 100644 --- a/FileSaver.js +++ b/FileSaver.js @@ -1,6 +1,6 @@ /* FileSaver.js * A saveAs() FileSaver implementation. - * 1.2.2 + * 1.3.0 * * By Eli Grey, http://eligrey.com * License: MIT diff --git a/README.md b/README.md index 6e7cb1b..3ff822a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Syntax ------ ```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)). @@ -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. [canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this. diff --git a/bower.json b/bower.json index dd508e7..e2e08b0 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "file-saver", "main": "FileSaver.js", - "version": "1.2.2", + "version": "1.3.0", "homepage": "https://github.com/eligrey/FileSaver.js", "authors": [ "Eli Grey " diff --git a/package.json b/package.json index aa7aadb..e492d31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "file-saver", - "version": "1.2.2", + "version": "1.3.0", "description": "An HTML5 saveAs() FileSaver implementation", "main": "FileSaver.js", "scripts": {