{"_id":"filesaver.js","_rev":"30-28014f733fbc1f6ee1c1c235d29c7b77","name":"filesaver.js","time":{"modified":"2022-06-18T00:45:15.126Z","created":"2013-09-25T20:31:23.201Z","2013.1.23":"2013-09-25T20:31:24.991Z","0.1.0":"2014-05-28T14:11:48.971Z","0.1.1":"2014-12-23T14:43:10.165Z","0.2.0":"2015-08-02T01:01:25.137Z","1.3.4":"2018-01-13T01:13:09.753Z"},"maintainers":[{"email":"jimmy@warting.se","name":"endless"},{"email":"~@eligrey.com","name":"eli"}],"dist-tags":{"latest":"1.3.4"},"description":"An HTML5 saveAs() FileSaver implementation","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","versions":{"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":"grassick","email":"clayton@mwater.co"}],"dist":{"shasum":"e8fcd7d2b56329329a609ccb27caf0c0deeac1cc","tarball":"https://registry.npmjs.org/filesaver.js/-/filesaver.js-0.1.0.tgz","integrity":"sha512-O+ZpEVPnqMu7BhqU02NF1wZvc84IdJmF6byVr3qsBC3V2FtEUwm9V+px7ccYzIPFTYggLyKWXvM1A7IvVIBUig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEejrYn8ewEuDylO2rmyPzbhAt79gBqMXcsXitLY1NZYAiEAllv1ECL7YLYILtLfwD1BmPJ8Y8OBEeZ2LmoQ9C5FtW8="}]},"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":"grassick","email":"clayton@mwater.co"}],"dist":{"shasum":"ea8b767b04ee631fb13e66e1f5654bfa6b5f5663","tarball":"https://registry.npmjs.org/filesaver.js/-/filesaver.js-0.1.1.tgz","integrity":"sha512-tIznPGIVWoSyYUTDvcg1mSwf18PQSBlz5K8ifZhhb839vuL/ULhATF4xcc/8Zg5Z2VrP9gWownNb5GdyVhpVnA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCurfISfipQEyGNTXi75KwmARNBvvxF3wPjacsf4rWB0QIhAMcTnVTqJ1DXXonzA9PcBGYvw1B80S3xEu8LICM/0BFk"}]},"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":"grassick","email":"clayton@mwater.co"}],"dist":{"shasum":"2657dc471ec78f2d405d9da066cf039a5be69802","tarball":"https://registry.npmjs.org/filesaver.js/-/filesaver.js-0.2.0.tgz","integrity":"sha512-Njqcent2+p3zBI+0ybTvKE+0Ylp5INuxCFumQyjPOUbF0lLjQxnmPdxtW9NxCOF+zvR/3tFvKTxpuymh7qipZw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB5nYi5JPyYYKAKNn6bnuSBQcji4ZsZ/3p3SOpMdnTzBAiEA1NF5JttDvmySUH4PIdwTP95NnKM5mLIgsizZmKig5c0="}]},"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"},"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":{"integrity":"sha512-mkBMT9o4jEejgiG85bYn1jZvJ3V6UtOo8Afhn2h0FTlon4oMuDNNIEIZD61NvZwY4ruAsyFhXuYitFK77UwC+Q==","shasum":"7911a6313ae84fa370418b2be5e75842b5be5b17","tarball":"https://registry.npmjs.org/filesaver.js/-/filesaver.js-1.3.4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHy34CeylIeJCIScPJu83FvepT6dmoysZQUUvKZ2s+ntAiBfBtf6NFqCcEOEz9PizhWv+3nKwhTLA3nUTqLFy/E3bA=="}]},"maintainers":[{"email":"jimmy@warting.se","name":"endless"},{"email":"~@eligrey.com","name":"eli"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/filesaver.js-1.3.4.tgz_1515805989688_0.8657878213562071"},"deprecated":"Unmaintained namespace. Please use the file-saver package: https://www.npmjs.com/package/file-saver"}},"homepage":"https://github.com/eligrey/FileSaver.js#readme","keywords":["filesaver","saveas","blob"],"repository":{"type":"git","url":"git+https://github.com/eligrey/FileSaver.js.git"},"author":{"name":"Eli Grey","email":"me@eligrey.com"},"bugs":{"url":"https://github.com/eligrey/FileSaver.js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"thebearingedge":true,"tamlyn":true,"wfalkwallace":true,"ncoop":true,"datatypes":true,"castasamu":true,"diniduddd":true}}