Is there any javascript or Chrome extension API, that would allow downloading a file to a specific folder under a specific name? The intent is to improve upon the saver of TiddlyWiki and/or provide similar "self-overriding file" functionality in order to allow easily saving back on top of a file previously opened in the browser.
In https://stackoverflow.com/a/9834261/2075630 a method for displaying a "Save file" dialog for a blob is demonstrated. However, this method can only suggest a file name.
- It cannot determine the folder for which the Save dialog will be displayed. Depending on user-settins, it will default to either automatically downloading the file to some Downloads folder, or displaying the Save dialog.
- In either case, if the file name already exists, chrome will save the file as
filename (1).dat
,filename (2).dat
, etc by default.
With this facility it isn't possible to create a confortable "Save-back" function that allows to:
- Open a file from the local filesystem, and
- Overwrite it with changed contents, without the risk of creating duplicates.
Notes
There seems to be an experimental Writeable Files API [stackoverflow,google] in Chrome, that will enable something similar. I'm not clear though, on whether Chrome considers
file://
URIs as secure context.The
chrome.fileSystem
API might provide the necessary features, but it should not be available to extensions.