{"_id":"filesaver.js","_rev":"392360","name":"filesaver.js","description":"An HTML5 saveAs() FileSaver implementation","dist-tags":{"latest":"1.3.4"},"maintainers":[{"name":"eli","email":"~@eligrey.com"},{"name":"endless","email":"jimmy@warting.se"}],"time":{"modified":"2021-08-04T03:58:37.000Z","created":"2014-05-28T14:11:48.971Z","1.3.4":"2018-01-13T01:13:09.753Z","0.2.0":"2015-08-02T01:01:25.137Z","0.1.1":"2014-12-23T14:43:10.165Z","0.1.0":"2014-05-28T14:11:48.971Z"},"users":{"thebearingedge":true,"tamlyn":true,"ncoop":true,"datatypes":true,"wfalkwallace":true,"castasamu":true,"diniduddd":true},"author":{"name":"Eli Grey","email":"me@eligrey.com"},"repository":{"type":"git","url":"git+https://github.com/eligrey/FileSaver.js.git"},"versions":{"1.3.4":{"name":"filesaver.js","version":"1.3.4","description":"An HTML5 saveAs() FileSaver implementation","main":"FileSaver.js","scripts":{"test":"echo \"Error: no test specified\" && exit 0","build":"uglifyjs FileSaver.js --mangle --comments /@source/ > FileSaver.min.js"},"repository":{"type":"git","url":"git+https://github.com/eligrey/FileSaver.js.git"},"keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey","email":"me@eligrey.com"},"license":"MIT","bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"homepage":"https://github.com/eligrey/FileSaver.js#readme","devDependencies":{"uglify-js":"^2.6.2"},"gitHead":"b4a918669accb81f184c610d741a4a8e1306aa27","_id":"filesaver.js@1.3.4","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"eli","email":"~@eligrey.com"},"dist":{"shasum":"7911a6313ae84fa370418b2be5e75842b5be5b17","size":10317,"noattachment":false,"key":"/filesaver.js/-/filesaver.js-1.3.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/filesaver.js/download/filesaver.js-1.3.4.tgz"},"maintainers":[{"name":"eli","email":"~@eligrey.com"},{"name":"endless","email":"jimmy@warting.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/filesaver.js-1.3.4.tgz_1515805989688_0.8657878213562071"},"directories":{},"publish_time":1515805989753,"_hasShrinkwrap":false,"_cnpm_publish_time":1515805989753,"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"},"0.2.0":{"name":"filesaver.js","version":"0.2.0","description":"An HTML5 saveAs() FileSaver implementation","main":"FileSaver.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mWater/FileSaver.js.git"},"keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey"},"license":"MIT/X11","bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"homepage":"https://github.com/mWater/FileSaver.js","gitHead":"df2cdac54cd0119536fb08290796a03a8660b785","_id":"filesaver.js@0.2.0","_shasum":"2657dc471ec78f2d405d9da066cf039a5be69802","_from":".","_npmVersion":"2.12.0","_nodeVersion":"0.10.36","_npmUser":{"name":"grassick","email":"clayton@mwater.co"},"maintainers":[{"name":"eli","email":"~@eligrey.com"},{"name":"endless","email":"jimmy@warting.se"}],"dist":{"shasum":"2657dc471ec78f2d405d9da066cf039a5be69802","size":10236,"noattachment":false,"key":"/filesaver.js/-/filesaver.js-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filesaver.js/download/filesaver.js-0.2.0.tgz"},"directories":{},"publish_time":1438477285137,"_cnpm_publish_time":1438477285137,"_hasShrinkwrap":false,"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"},"0.1.1":{"name":"filesaver.js","version":"0.1.1","description":"An HTML5 saveAs() FileSaver implementation","main":"FileSaver.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/mWater/FileSaver.js.git"},"keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey"},"license":"MIT/X11","bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"homepage":"https://github.com/mWater/FileSaver.js","gitHead":"ba0f2f569acdbd5915b529cfe9cf24cbee5d89a6","_id":"filesaver.js@0.1.1","_shasum":"ea8b767b04ee631fb13e66e1f5654bfa6b5f5663","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.28","_npmUser":{"name":"grassick","email":"clayton@mwater.co"},"maintainers":[{"name":"eli","email":"~@eligrey.com"},{"name":"endless","email":"jimmy@warting.se"}],"dist":{"shasum":"ea8b767b04ee631fb13e66e1f5654bfa6b5f5663","size":10015,"noattachment":false,"key":"/filesaver.js/-/filesaver.js-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/filesaver.js/download/filesaver.js-0.1.1.tgz"},"directories":{},"publish_time":1419345790165,"_cnpm_publish_time":1419345790165,"_hasShrinkwrap":false,"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"},"0.1.0":{"name":"filesaver.js","version":"0.1.0","description":"An HTML5 saveAs() FileSaver implementation","main":"FileSaver.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/mWater/FileSaver.js.git"},"keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey"},"license":"MIT/X11","bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"homepage":"https://github.com/mWater/FileSaver.js","gitHead":"b8054a26d13dd700a948735fc05e952c3b7db6c5","_id":"filesaver.js@0.1.0","_shasum":"e8fcd7d2b56329329a609ccb27caf0c0deeac1cc","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"grassick","email":"clayton@mwater.co"},"maintainers":[{"name":"eli","email":"~@eligrey.com"},{"name":"endless","email":"jimmy@warting.se"}],"dist":{"shasum":"e8fcd7d2b56329329a609ccb27caf0c0deeac1cc","size":8592,"noattachment":false,"key":"/filesaver.js/-/filesaver.js-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/filesaver.js/download/filesaver.js-0.1.0.tgz"},"directories":{},"publish_time":1401286308971,"_cnpm_publish_time":1401286308971,"_hasShrinkwrap":false,"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"}},"readme":"If you need to save really large files bigger then the blob's size limitation or don't have \r\nenough RAM, then have a look at the more advanced [StreamSaver.js](https://github.com/jimmywarting/StreamSaver.js)\r\nthat can save data directly to the hard drive asynchronously with the power of the new streams API. That will have\r\nsupport for progress, cancelation and knowing when it's done writing\r\n\r\nFileSaver.js\r\n============\r\n\r\nFileSaver.js implements the `saveAs()` FileSaver interface in browsers that do\r\nnot natively support it. There is a [FileSaver.js demo][1] that demonstrates saving\r\nvarious media types.\r\n\r\nFileSaver.js is the solution to saving files on the client-side, and is perfect for\r\nwebapps that need to generate files, or for saving sensitive information that shouldn't be\r\nsent to an external server.\r\n\r\nLooking for `canvas.toBlob()` for saving canvases? Check out\r\n[canvas-toBlob.js][2] for a cross-browser implementation.\r\n\r\nSupported browsers\r\n------------------\r\n\r\n| Browser        | Constructs as | Filenames    | Max Blob Size | Dependencies |\r\n| -------------- | ------------- | ------------ | ------------- | ------------ |\r\n| Firefox 20+    | Blob          | Yes          | 800 MiB       | None         |\r\n| Firefox < 20   | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\r\n| Chrome         | Blob          | Yes          | [500 MiB][3]  | None         |\r\n| Chrome for Android | Blob      | Yes          | [500 MiB][3]  | None         |\r\n| Edge           | Blob          | Yes          | ?             | None         |\r\n| IE 10+         | Blob          | Yes          | 600 MiB       | None         |\r\n| Opera 15+      | Blob          | Yes          | 500 MiB       | None         |\r\n| Opera < 15     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\r\n| Safari 6.1+*   | Blob          | No           | ?             | None         |\r\n| Safari < 6     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\r\n| Safari 10.1+   | Blob          | Yes          | n/a           | None         |\r\n\r\nFeature detection is possible:\r\n\r\n```js\r\ntry {\r\n    var isFileSaverSupported = !!new Blob;\r\n} catch (e) {}\r\n```\r\n\r\n### IE < 10\r\n\r\nIt is possible to save text files in IE < 10 without Flash-based polyfills.\r\nSee [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details.\r\n\r\n### Safari 6.1+\r\n\r\nBlobs may be opened instead of saved sometimes—you may have to direct your Safari users to manually\r\npress <kbd>⌘</kbd>+<kbd>S</kbd> to save the file after it is opened. Using the `application/octet-stream` MIME type to force downloads [can cause issues in Safari](https://github.com/eligrey/FileSaver.js/issues/12#issuecomment-47247096).\r\n\r\n### iOS\r\n\r\nsaveAs must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering. Due to restrictions in iOS saveAs opens in a new window instead of downloading, if you want this fixed please [tell Apple](https://bugs.webkit.org/show_bug.cgi?id=102914) how this bug is affecting you.\r\n\r\nSyntax\r\n------\r\n\r\n```js\r\nFileSaver saveAs(Blob/File data, optional DOMString filename, optional Boolean disableAutoBOM)\r\n```\r\n\r\nPass `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)).\r\n\r\nExamples\r\n--------\r\n\r\n### Saving text using require\r\n```js\r\nvar FileSaver = require('file-saver');\r\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\r\nFileSaver.saveAs(blob, \"hello world.txt\");\r\n```\r\n\r\n### Saving text\r\n\r\n```js\r\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\r\nsaveAs(blob, \"hello world.txt\");\r\n```\r\n\r\nThe standard W3C File API [`Blob`][4] interface is not available in all browsers.\r\n[Blob.js][5] is a cross-browser `Blob` implementation that solves this.\r\n\r\n### Saving a canvas\r\n\r\n```js\r\nvar canvas = document.getElementById(\"my-canvas\"), ctx = canvas.getContext(\"2d\");\r\n// draw to canvas...\r\ncanvas.toBlob(function(blob) {\r\n    saveAs(blob, \"pretty image.png\");\r\n});\r\n```\r\n\r\nNote: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.\r\n[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.\r\n\r\n### Saving File\r\n\r\nYou can save a File constructor without specifying a filename. The\r\nFile itself already contains a name, There is a hand full of ways to get a file\r\ninstance (from storage, file input, new constructor)\r\nBut if you still want to change the name, then you can change it in the 2nd argument\r\n\r\n```js\r\nvar file = new File([\"Hello, world!\"], \"hello world.txt\", {type: \"text/plain;charset=utf-8\"});\r\nsaveAs(file);\r\n```\r\n\r\n\r\n\r\n![Tracking image](https://in.getclicky.com/212712ns.gif)\r\n\r\n  [1]: http://eligrey.com/demos/FileSaver.js/\r\n  [2]: https://github.com/eligrey/canvas-toBlob.js\r\n  [3]: https://code.google.com/p/chromium/issues/detail?id=375297\r\n  [4]: https://developer.mozilla.org/en-US/docs/DOM/Blob\r\n  [5]: https://github.com/eligrey/Blob.js\r\n  [6]: https://github.com/eligrey/canvas-toBlob.js\r\n\r\nContributing\r\n------------\r\n\r\nThe `FileSaver.js` distribution file is compiled with Uglify.js like so:\r\n\r\n```bash\r\nuglifyjs FileSaver.js --mangle --comments /@source/ > FileSaver.min.js\r\n# or simply:\r\nnpm run build\r\n```\r\n\r\nPlease make sure you build a production version before submitting a pull request.\r\n\r\nInstallation\r\n------------------\r\n\r\n```bash\r\nnpm install file-saver --save\r\nbower install file-saver\r\n```\r\n\r\nAdditionally, TypeScript definitions can be installed via:\r\n\r\n```bash\r\nnpm install @types/file-saver --save-dev\r\n```\r\n","_attachments":{},"homepage":"https://github.com/eligrey/FileSaver.js#readme","bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"license":"MIT"}