Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e865e37af9 | ||
|
|
a606064f37 | ||
|
|
28a86d90c4 | ||
|
|
5914e2a573 | ||
|
|
6356c3f6f6 | ||
|
|
24f9aaca80 | ||
|
|
f1959c87cd | ||
|
|
dfd58561fb | ||
|
|
a5dbf55c17 | ||
|
|
5978f3c577 | ||
|
|
9570cf7362 | ||
|
|
b1158d0c33 | ||
|
|
b6c236d96d | ||
|
|
164deec5ab | ||
|
|
99a89750b0 | ||
|
|
ff675f8052 | ||
|
|
17d5c67eb3 | ||
|
|
70bb521e5d | ||
|
|
b4c11367c0 | ||
|
|
281a1c1a93 | ||
|
|
d02373e40d | ||
|
|
d7f5db3244 |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": [
|
||||
"ie > 9"
|
||||
]
|
||||
}
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-es2015-modules-umd"
|
||||
],
|
||||
"env": {
|
||||
"production": {
|
||||
"presets": ["minify"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
node_modules/
|
||||
.DS_Store
|
||||
.idea/
|
||||
|
||||
# Generated files
|
||||
/dist/
|
||||
Vendored
-2
@@ -1,2 +0,0 @@
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
var saveAs=saveAs||function(e){"use strict";if(!("undefined"==typeof e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,n=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,d=/CriOS\/[\d]+/.test(navigator.userAgent),f=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",u=4e4,c=function(e){var t=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};setTimeout(t,u)},l=function(e,t,n){t=[].concat(t);for(var o=t.length;o--;){var r=e["on"+t[o]];if("function"==typeof r)try{r.call(e,n||e)}catch(a){f(a)}}},v=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},p=function(t,f,u){u||(t=v(t));var p,w=this,m=t.type,y=m===s,S=function(){l(w,"writestart progress write writeend".split(" "))},h=function(){if((d||y&&i)&&e.FileReader){var o=new FileReader;return o.onloadend=function(){var t=d?o.result:o.result.replace(/^data:[^;]*;/,"data:attachment/file;"),n=e.open(t,"_blank");n||(e.location.href=t),t=void 0,w.readyState=w.DONE,S()},o.readAsDataURL(t),void(w.readyState=w.INIT)}if(p||(p=n().createObjectURL(t)),y)e.location.href=p;else{var r=e.open(p,"_blank");r||(e.location.href=p)}w.readyState=w.DONE,S(),c(p)};return w.readyState=w.INIT,r?(p=n().createObjectURL(t),void setTimeout(function(){o.href=p,o.download=f,a(o),S(),c(p),w.readyState=w.DONE})):void h()},w=p.prototype,m=function(e,t,n){return new p(e,t||e.name||"download",n)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return t=t||e.name||"download",n||(e=v(e)),navigator.msSaveOrOpenBlob(e,t)}:(w.abort=function(){},w.readyState=w.INIT=0,w.WRITING=1,w.DONE=2,w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null,m)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this);"undefined"!=typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!=typeof define&&null!==define&&null!==define.amd&&define("FileSaver.js",function(){return saveAs});
|
||||
@@ -79,7 +79,7 @@ FileSaver.saveAs(blob, "hello world.txt");
|
||||
|
||||
```js
|
||||
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
|
||||
saveAs(blob, "hello world.txt");
|
||||
FileSaver.saveAs(blob, "hello world.txt");
|
||||
```
|
||||
|
||||
The standard W3C File API [`Blob`][4] interface is not available in all browsers.
|
||||
@@ -107,7 +107,7 @@ But if you still want to change the name, then you can change it in the 2nd argu
|
||||
|
||||
```js
|
||||
var file = new File(["Hello, world!"], "hello world.txt", {type: "text/plain;charset=utf-8"});
|
||||
saveAs(file);
|
||||
FileSaver.saveAs(file);
|
||||
```
|
||||
|
||||
|
||||
@@ -121,19 +121,6 @@ saveAs(file);
|
||||
[5]: https://github.com/eligrey/Blob.js
|
||||
[6]: https://github.com/eligrey/canvas-toBlob.js
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
The `FileSaver.js` distribution file is compiled with Uglify.js like so:
|
||||
|
||||
```bash
|
||||
uglifyjs FileSaver.js --mangle --comments /@source/ > FileSaver.min.js
|
||||
# or simply:
|
||||
npm run build
|
||||
```
|
||||
|
||||
Please make sure you build a production version before submitting a pull request.
|
||||
|
||||
Installation
|
||||
------------------
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "file-saver",
|
||||
"main": "FileSaver.js",
|
||||
"version": "1.3.3",
|
||||
"main": "dist/FileSaver.js",
|
||||
"version": "1.3.8",
|
||||
"homepage": "https://github.com/eligrey/FileSaver.js",
|
||||
"authors": [
|
||||
"Eli Grey <[email protected]>"
|
||||
|
||||
Generated
+2783
File diff suppressed because it is too large
Load Diff
+16
-4
@@ -1,11 +1,20 @@
|
||||
{
|
||||
"name": "file-saver",
|
||||
"version": "1.3.4",
|
||||
"version": "1.3.8",
|
||||
"description": "An HTML5 saveAs() FileSaver implementation",
|
||||
"main": "FileSaver.js",
|
||||
"main": "dist/FileSaver.js",
|
||||
"module": "src/FileSaver.js",
|
||||
"files": [
|
||||
"dist/FileSaver.js",
|
||||
"dist/FileSaver.min.js",
|
||||
"src/FileSaver.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 0",
|
||||
"build": "node_modules/.bin/uglifyjs FileSaver.js --mangle --comments /@source/ > FileSaver.min.js"
|
||||
"build:development": "mkdir -p dist && babel src/FileSaver.js --out-file=dist/FileSaver.js",
|
||||
"build:production": "NODE_ENV=production npm run build:development -- --out-file=dist/FileSaver.min.js",
|
||||
"build": "npm run build:development && npm run build:production",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -23,6 +32,9 @@
|
||||
},
|
||||
"homepage": "https://github.com/eligrey/FileSaver.js#readme",
|
||||
"devDependencies": {
|
||||
"uglify-js": "^2.6.2"
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-minify": "^0.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* FileSaver.js
|
||||
* A saveAs() FileSaver implementation.
|
||||
* 1.3.4
|
||||
* 2018-01-12 13:14:0
|
||||
* 1.3.8
|
||||
* 2018-03-22 14:03:47
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* By Eli Grey, https://eligrey.com
|
||||
* License: MIT
|
||||
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
|
||||
*/
|
||||
@@ -11,9 +11,9 @@
|
||||
/*global self */
|
||||
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/src/FileSaver.js */
|
||||
|
||||
var saveAs = saveAs || (function(view) {
|
||||
export var saveAs = saveAs || (function(view) {
|
||||
"use strict";
|
||||
// IE <10 is explicitly unsupported
|
||||
if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
|
||||
@@ -33,8 +33,9 @@ var saveAs = saveAs || (function(view) {
|
||||
}
|
||||
, is_safari = /constructor/i.test(view.HTMLElement) || view.safari
|
||||
, is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
|
||||
, setImmediate = view.setImmediate || view.setTimeout
|
||||
, throw_outside = function(ex) {
|
||||
(view.setImmediate || view.setTimeout)(function() {
|
||||
setImmediate(function() {
|
||||
throw ex;
|
||||
}, 0);
|
||||
}
|
||||
@@ -125,14 +126,14 @@ var saveAs = saveAs || (function(view) {
|
||||
|
||||
if (can_use_save_link) {
|
||||
object_url = get_URL().createObjectURL(blob);
|
||||
setTimeout(function() {
|
||||
setImmediate(function() {
|
||||
save_link.href = object_url;
|
||||
save_link.download = name;
|
||||
click(save_link);
|
||||
dispatch_all();
|
||||
revoke(object_url);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
});
|
||||
}, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,6 +144,7 @@ var saveAs = saveAs || (function(view) {
|
||||
return new FileSaver(blob, name || blob.name || "download", no_auto_bom);
|
||||
}
|
||||
;
|
||||
|
||||
// IE 10+ (native saveAs)
|
||||
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
|
||||
return function(blob, name, no_auto_bom) {
|
||||
@@ -155,6 +157,9 @@ var saveAs = saveAs || (function(view) {
|
||||
};
|
||||
}
|
||||
|
||||
// todo: detect chrome extensions & packaged apps
|
||||
//save_link.target = "_blank";
|
||||
|
||||
FS_proto.abort = function(){};
|
||||
FS_proto.readyState = FS_proto.INIT = 0;
|
||||
FS_proto.WRITING = 1;
|
||||
@@ -175,11 +180,3 @@ var saveAs = saveAs || (function(view) {
|
||||
|| typeof window !== "undefined" && window
|
||||
|| this
|
||||
));
|
||||
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
module.exports.saveAs = saveAs;
|
||||
} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) {
|
||||
define("FileSaver.js", function() {
|
||||
return saveAs;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user