I'm working on a Chrome extension to be used as an internal tool. Its required behavior is:
This question has been asked before, but the answer then was "use NPAPI", and NPAPI is now derelict.
So, what is the currently available way to achieve this? The ones I've looked at are:
Is there another approach I can try?
When extensions are installed into Chrome they are extracted into the C:\Users\[login_name]\AppData\Local\Google\Chrome\User Data\Default\Extensions folder. Each extension will be stored in its own folder named after the ID of the extension.
Allows app or extension to create, read, navigate, and write to the user's local file system at a user-selected location. (Chrome OS only) Allows app or extension to create file systems that can be accessible from the file manager on a Chrome device.
Yes, it can. Extensions asks for permission(s) just before you install them. Permission like tabs, read and change all your data.., etc.
You've done quite a lot of research. Indeed, regular web pages cannot write to the user's filesystem without any plugins or extensions. Also, the HTML5 Filesystem API only provides access to a virtual filesystem, as you've observed.
However, you are confusing the chrome.fileSystem
API with the HTML5 FileSystem API. Unlike the HTML FileSystem API, Chrome's fileSystem
(app) API can directly write to the user's filesystem (e.g. ~/Documents
or %USERPROFILE%\Documents
), specified by the user.
This API is only available to Chrome apps, not extensions. This is not a problem, especially since you're developing an internal tool, because you can install the app and extension, and use message passing to communicate between the extension (page action) and app (file system access) (example).
About chrome.downloads
: Since your extension is internal, you can probably force users to get on the beta/dev channel in order to use this API. The only limitation of this API is that the files will be saved in (a subdirectory of) the user-defined Downloads folder.
EDIT: The chrome.downloads
API is now avaiable in all channels, including the stable branch (since Chrome 31).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With