{"_id":"s-file-saver","_rev":"1-16b4d34e054c080cb9040ca71182a753","name":"s-file-saver","dist-tags":{"latest":"2.0.6"},"versions":{"2.0.5":{"name":"s-file-saver","version":"2.0.5","keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey","email":"me@eligrey.com"},"license":"MIT","_id":"s-file-saver@2.0.5","maintainers":[{"name":"sujiewen","email":"sujiewen@qq.com"}],"homepage":"https://github.com/sujiewen/FileSaver.js#readme","bugs":{"url":"https://github.com/sujiewen/FileSaver.js/issues"},"dist":{"shasum":"da69bc6c1f3b1b561f9c4f2dd26ce0cc2500e781","tarball":"https://registry.npmjs.org/s-file-saver/-/s-file-saver-2.0.5.tgz","fileCount":7,"integrity":"sha512-Pptp1IPvBWhb/RLAOiLAVQwZyA+MooB/iMF0BObXd86JaimX6CaOu73mDYCtw+NgI5cHBqOkFeGGqHqUa+5QBA==","signatures":[{"sig":"MEQCIB4V/6N54xpmrUCkrrp+qs1R6zeNVRNzptmyn9SXOIPmAiBgGUHlWGIJ4j2hRbU9PMkmeWu+jH5uUWgcRtNwRTWwPQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33784},"main":"dist/FileSaver.min.js","gitHead":"8045abedce7114bc78484389d36c2660f2e8bbc7","scripts":{"test":"echo \"Error: no test specified\" && exit 0","build":"npm run build:development && npm run build:production","prepublishOnly":"npm run build","build:production":"babel -o dist/FileSaver.min.js -s --plugins @babel/plugin-transform-modules-umd --presets minify src/FileSaver.js","build:development":"babel -o dist/FileSaver.js --plugins @babel/plugin-transform-modules-umd src/FileSaver.js"},"_npmUser":{"name":"sujiewen","email":"sujiewen@qq.com"},"repository":{"url":"git+https://github.com/sujiewen/FileSaver.js.git","type":"git"},"_npmVersion":"10.7.0","description":"An HTML5 saveAs() FileSaver implementation","directories":{},"_nodeVersion":"18.20.4","_hasShrinkwrap":false,"devDependencies":{"@babel/cli":"^7.1.0","@babel/core":"^7.1.0","babel-preset-minify":"^0.4.3","@babel/plugin-transform-modules-umd":"^7.1.0"},"_npmOperationalInternal":{"tmp":"tmp/s-file-saver_2.0.5_1737622947452_0.885639777968716","host":"s3://npm-registry-packages-npm-production"}},"2.0.6":{"name":"s-file-saver","version":"2.0.6","description":"An HTML5 saveAs() FileSaver implementation","main":"dist/FileSaver.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 0","build:development":"babel -o dist/FileSaver.js --plugins @babel/plugin-transform-modules-umd src/FileSaver.js","build:production":"babel -o dist/FileSaver.min.js -s --plugins @babel/plugin-transform-modules-umd --presets minify src/FileSaver.js","build":"npm run build:development && npm run build:production","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/sujiewen/FileSaver.js.git"},"keywords":["filesaver","saveas","blob"],"author":{"name":"Eli Grey","email":"me@eligrey.com"},"license":"MIT","homepage":"https://github.com/sujiewen/FileSaver.js#readme","devDependencies":{"@babel/cli":"^7.1.0","@babel/core":"^7.1.0","@babel/plugin-transform-modules-umd":"^7.1.0","babel-preset-minify":"^0.4.3"},"_id":"s-file-saver@2.0.6","gitHead":"a0907699660554eb3e1488376fd2e3f22c406e97","bugs":{"url":"https://github.com/sujiewen/FileSaver.js/issues"},"_nodeVersion":"18.20.4","_npmVersion":"10.7.0","dist":{"integrity":"sha512-cpy8gRJt2gcLNBIbVf0y82/M1UOndwi1h+u2hyXEO131RMJPySKPGRZdKDvWju/0Ozv9aWzliGQBR6blxvaffg==","shasum":"1874e117d89a8d9495a32ac3baf6ebfd89f1c0d0","tarball":"https://registry.npmjs.org/s-file-saver/-/s-file-saver-2.0.6.tgz","fileCount":7,"unpackedSize":33863,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIENWToRAggb8Cr+VYPJLulLLUl+X6cWU8n0hbehzP4vNAiEApGlSgaBBuQYeaYoUQUjFoxBrBCxbVmA2QH4BKbi6n0E="}]},"_npmUser":{"name":"sujiewen","email":"sujiewen@qq.com"},"directories":{},"maintainers":[{"name":"sujiewen","email":"sujiewen@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/s-file-saver_2.0.6_1737624494590_0.5050740103730549"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-23T09:02:27.366Z","modified":"2025-01-23T09:28:14.959Z","2.0.5":"2025-01-23T09:02:27.632Z","2.0.6":"2025-01-23T09:28:14.780Z"},"bugs":{"url":"https://github.com/sujiewen/FileSaver.js/issues"},"author":{"name":"Eli Grey","email":"me@eligrey.com"},"license":"MIT","homepage":"https://github.com/sujiewen/FileSaver.js#readme","keywords":["filesaver","saveas","blob"],"repository":{"type":"git","url":"git+https://github.com/sujiewen/FileSaver.js.git"},"description":"An HTML5 saveAs() FileSaver implementation","maintainers":[{"name":"sujiewen","email":"sujiewen@qq.com"}],"readme":"If you need to save really large files bigger than the blob's size limitation or don't have\nenough RAM, then have a look at the more advanced [StreamSaver.js][7]\nthat can save data directly to the hard drive asynchronously with the power of the new streams API. That will have\nsupport for progress, cancelation and knowing when it's done writing\n\nFileSaver.js\n============\n\nFileSaver.js is the solution to saving files on the client-side, and is perfect for\nweb apps that generates files on the client, However if the file is coming from the\nserver we recommend you to first try to use [Content-Disposition][8] attachment response header as it has more cross-browser compatiblity.\n\nLooking for `canvas.toBlob()` for saving canvases? Check out\n[canvas-toBlob.js][2] for a cross-browser implementation.\n\nSupported Browsers\n------------------\n\n| Browser        | Constructs as | Filenames    | Max Blob Size | Dependencies |\n| -------------- | ------------- | ------------ | ------------- | ------------ |\n| Firefox 20+    | Blob          | Yes          | 800 MiB       | None         |\n| Firefox < 20   | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Chrome         | Blob          | Yes          | [2GB][3]      | None         |\n| Chrome for Android | Blob      | Yes          | [RAM/5][3]    | None         |\n| Edge           | Blob          | Yes          | ?             | None         |\n| IE 10+         | Blob          | Yes          | 600 MiB       | None         |\n| Opera 15+      | Blob          | Yes          | 500 MiB       | None         |\n| Opera < 15     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Safari 6.1+*   | Blob          | No           | ?             | None         |\n| Safari < 6     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Safari 10.1+   | Blob          | Yes          | n/a           | None         |\n\nFeature detection is possible:\n\n```js\ntry {\n    var isFileSaverSupported = !!new Blob;\n} catch (e) {}\n```\n\n### IE < 10\n\nIt is possible to save text files in IE < 10 without Flash-based polyfills.\nSee [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details.\n\n### Safari 6.1+\n\nBlobs may be opened instead of saved sometimes—you may have to direct your Safari users to manually\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).\n\n### iOS\n\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 how this WebKit bug is affecting you](https://bugs.webkit.org/show_bug.cgi?id=167341).\n\nSyntax\n------\n### Import `saveAs()` from file-saver\n```js\nimport { saveAs } from 'file-saver';\n```\n\n```js\nFileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Object { autoBom })\n```\n\nPass `{ autoBom: true }` if you want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)). Note that this is only done if your blob type has `charset=utf-8` set.\n\nExamples\n--------\n\n### Saving text using `require()`\n```js\nvar FileSaver = require('file-saver');\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(blob, \"hello world.txt\");\n```\n\n### Saving text\n\n```js\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(blob, \"hello world.txt\");\n```\n\n### Saving URLs\n\n```js\nFileSaver.saveAs(\"https://httpbin.org/image\", \"image.jpg\");\n```\nUsing URLs within the same origin will just use `a[download]`.\nOtherwise, it will first check if it supports cors header with a synchronous head request.\nIf it does, it will download the data and save using blob URLs.\nIf not, it will try to download it using `a[download]`.\n\nThe standard W3C File API [`Blob`][4] interface is not available in all browsers.\n[Blob.js][5] is a cross-browser `Blob` implementation that solves this.\n\n### Saving a canvas\n```js\nvar canvas = document.getElementById(\"my-canvas\");\ncanvas.toBlob(function(blob) {\n    saveAs(blob, \"pretty image.png\");\n});\n```\n\nNote: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.\n[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.\n\n### Saving File\n\nYou can save a File constructor without specifying a filename. If the\nfile itself already contains a name, there is a hand full of ways to get a file\ninstance (from storage, file input, new constructor, clipboard event).\nIf you still want to change the name, then you can change it in the 2nd argument.\n\n```js\n// Note: Ie and Edge don't support the new File constructor,\n// so it's better to construct blobs and use saveAs(blob, filename)\nvar file = new File([\"Hello, world!\"], \"hello world.txt\", {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(file);\n```\n\n\n\n![Tracking image](https://in.getclicky.com/212712ns.gif)\n\n  [1]: http://eligrey.com/demos/FileSaver.js/\n  [2]: https://github.com/eligrey/canvas-toBlob.js\n  [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=375297#c107\n  [4]: https://developer.mozilla.org/en-US/docs/DOM/Blob\n  [5]: https://github.com/eligrey/Blob.js\n  [6]: https://github.com/eligrey/canvas-toBlob.js\n  [7]: https://github.com/jimmywarting/StreamSaver.js\n  [8]: https://github.com/eligrey/FileSaver.js/wiki/Saving-a-remote-file#using-http-header\n\nInstallation\n------------------\n\n```bash\n# Basic Node.JS installation\nnpm install file-saver --save\nbower install file-saver\n```\n\nAdditionally, TypeScript definitions can be installed via:\n\n```bash\n# Additional typescript definitions\nnpm install @types/file-saver --save-dev\n```\n\n```bash\nfile-saver存储在github国内不能下载，所有另存为npm\n```\n\n","readmeFilename":"README.md"}