Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a918669a | ||
|
|
5733e40e5a | ||
|
|
74f089808e | ||
|
|
fe42ec4055 | ||
|
|
0b90542535 | ||
|
|
c3e4a45021 | ||
|
|
db089ce81e | ||
|
|
1bf9b35b54 | ||
|
|
c347c51f6e | ||
|
|
945f08bc74 | ||
|
|
dffa3a4989 | ||
|
|
4db4a78aad | ||
|
|
d89ed13171 | ||
|
|
aa9f4e0e03 | ||
|
|
cafa1bfebb | ||
|
|
5ed507ef8a | ||
|
|
eb8d76f845 | ||
|
|
8739c467c6 | ||
|
|
d8870ded68 | ||
|
|
7b242c2d78 |
+8
-11
@@ -1,7 +1,7 @@
|
|||||||
/* FileSaver.js
|
/* FileSaver.js
|
||||||
* A saveAs() FileSaver implementation.
|
* A saveAs() FileSaver implementation.
|
||||||
* 1.3.2
|
* 1.3.4
|
||||||
* 2016-06-16 18:25:19
|
* 2018-01-12 13:14:0
|
||||||
*
|
*
|
||||||
* By Eli Grey, http://eligrey.com
|
* By Eli Grey, http://eligrey.com
|
||||||
* License: MIT
|
* License: MIT
|
||||||
@@ -31,7 +31,7 @@ var saveAs = saveAs || (function(view) {
|
|||||||
var event = new MouseEvent("click");
|
var event = new MouseEvent("click");
|
||||||
node.dispatchEvent(event);
|
node.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
, is_safari = /constructor/i.test(view.HTMLElement)
|
, is_safari = /constructor/i.test(view.HTMLElement) || view.safari
|
||||||
, is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
|
, is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)
|
||||||
, throw_outside = function(ex) {
|
, throw_outside = function(ex) {
|
||||||
(view.setImmediate || view.setTimeout)(function() {
|
(view.setImmediate || view.setTimeout)(function() {
|
||||||
@@ -173,16 +173,13 @@ var saveAs = saveAs || (function(view) {
|
|||||||
}(
|
}(
|
||||||
typeof self !== "undefined" && self
|
typeof self !== "undefined" && self
|
||||||
|| typeof window !== "undefined" && window
|
|| typeof window !== "undefined" && window
|
||||||
|| this.content
|
|| this
|
||||||
));
|
));
|
||||||
// `self` is undefined in Firefox for Android content script context
|
|
||||||
// while `this` is nsIContentFrameMessageManager
|
|
||||||
// with an attribute `content` that corresponds to the window
|
|
||||||
|
|
||||||
if (typeof module !== "undefined" && module.exports) {
|
if (typeof module !== "undefined" && module.exports) {
|
||||||
module.exports.saveAs = saveAs;
|
module.exports.saveAs = saveAs;
|
||||||
} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) {
|
} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) {
|
||||||
define([], function() {
|
define("FileSaver.js", function() {
|
||||||
return saveAs;
|
return saveAs;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||||
var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,i=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},a=/constructor/i.test(e.HTMLElement),f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},d="application/octet-stream",s=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,s)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(i){u(i)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,s){if(!s){t=p(t)}var v=this,w=t.type,m=w===d,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&a)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;i(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return 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;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define([],function(){return saveAs})}
|
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});
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
The MIT License
|
||||||
|
|
||||||
Copyright © 2016 [Eli Grey][1].
|
Copyright © 2016 [Eli Grey][1].
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ Supported browsers
|
|||||||
| Opera < 15 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) |
|
| Opera < 15 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) |
|
||||||
| Safari 6.1+* | Blob | No | ? | None |
|
| Safari 6.1+* | Blob | No | ? | None |
|
||||||
| Safari < 6 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) |
|
| Safari < 6 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) |
|
||||||
|
| Safari 10.1+ | Blob | Yes | n/a | None |
|
||||||
|
|
||||||
Feature detection is possible:
|
Feature detection is possible:
|
||||||
|
|
||||||
@@ -67,6 +68,13 @@ Pass `true` for `disableAutoBOM` if you don't want FileSaver.js to automatically
|
|||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
### Saving text using require
|
||||||
|
```js
|
||||||
|
var FileSaver = require('file-saver');
|
||||||
|
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
|
||||||
|
FileSaver.saveAs(blob, "hello world.txt");
|
||||||
|
```
|
||||||
|
|
||||||
### Saving text
|
### Saving text
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@@ -133,3 +141,9 @@ Installation
|
|||||||
npm install file-saver --save
|
npm install file-saver --save
|
||||||
bower install file-saver
|
bower install file-saver
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Additionally, TypeScript definitions can be installed via:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @types/file-saver --save-dev
|
||||||
|
```
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "file-saver",
|
"name": "file-saver",
|
||||||
"main": "FileSaver.js",
|
"main": "FileSaver.js",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"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.3.2",
|
"version": "1.3.4",
|
||||||
"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