admin管理员组文章数量:1405621
I am aware that the HTML5 Filesystem API gives you access to a sandboxed file system. Let's say I write a file to the filesystem. Is it possible to let the user save that file to their actual file system? I would like to be able to tell the user where the file is written so that they may access it but that does not seem to be possible.
My only idea is to read the file as a data url and make a hyperlink that the user can save, but that has scalability issues in terms of file size.
I am aware that the HTML5 Filesystem API gives you access to a sandboxed file system. Let's say I write a file to the filesystem. Is it possible to let the user save that file to their actual file system? I would like to be able to tell the user where the file is written so that they may access it but that does not seem to be possible.
My only idea is to read the file as a data url and make a hyperlink that the user can save, but that has scalability issues in terms of file size.
Share Improve this question asked Oct 29, 2012 at 21:39 knpwrsknpwrs 16.6k12 gold badges66 silver badges104 bronze badges 1- Note really. You can create a local filesystem path based on browser though (possibly) that they could go to. – Linuxios Commented Oct 29, 2012 at 21:48
2 Answers
Reset to default 4You can use the URL obtained from the toURL
method as the value for a link's href attribute, which link in addition has a download
attribute. Clicking on the link will then prompt the user to save the contents on her filesystem.
Quoting MDN - Basic Concepts About the Filesystem API:
You can, however, export a file from a web app to a desktop app. For example, you can use the File API, create a blob, redirect an iframe to the blob, and invoke the download manager.
Also, the very page I linked to before discusses FileEntry
's toURL()
method which returns a url in the form of filesystem:
.
Here is another article on how to make the browser download a file from a url.
本文标签: javascriptHTML5 Filesystems APILetting Users Save Files to Their Actual FilesystemStack Overflow
版权声明:本文标题:javascript - HTML5 Filesystems API - Letting Users Save Files to Their Actual Filesystem - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744902465a2631423.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论