unlimited file storage in chrome app

前端 未结 2 1419
醉梦人生
醉梦人生 2020-12-30 17:29

I want to save an unlimited number of files to the users hard drive, without making the user click through a dialog box.

The only documentation I have seen on using

2条回答
  •  时光取名叫无心
    2020-12-30 18:20

    First of all, to avoid confusion, what here is being called a "packaged app" should be called a "Chrome App".

    If the blob is to be used by any other app, you must obtain a FileEntry via chrome.fileSystem.chooseEntry so the data will be written to the computer's file system where the user can access it. (You can obtain a directory that way from the user and save the retained entry, and use that without asking the user to make a choice every time.)

    If the blob is only for use by that Chrome App, you can use the file API without calling chrome.fileSystem.chooseEntry.

    As for limits, you're correct that unlimitedStorage allows unlimited storage. In my experiments, despite the documentation, I have never been able to get a Chrome App to ask the user to authorize a specific amount. I use that permission, and there seems to be no limit. The Google documentation I've read on this appears to be inaccurate.

    If you're writing to the external file system, after you've called chrome.fileSystem.chooseEntry, there are no limits and you don't need unlimitedStorage permission.

提交回复
热议问题