I’m looking for a way to store backups on users PC without user interaction AND something that could survive add-on uninstalling - or at least storage corruption. I need only few KB of space.
So far I have backups only in IndexedDB (that helps when user downgrades from Nightly channel), but I would like to offer better solution - more persistent. I have also cloud backup service, but not all users are using that.
You could probably devise some bookmark based backup system, which would be in a different data silo than indexedDB/storage.local (in the future)/localStorage
That’s a good idea for my use-case (speed-dial). Although I would like to store JSON data because my add-on has now a lot of features so user would still lost his special settings (metadata) related to those URL.
I was thinking more like some downloads API which is limited to “Downloads” folder (maybe with hidden sub-folder?).
Or something else, something that would get deleted over time - like cookies or history - history.addUrl({url: 'www.backup.bac/?30KB_of_JSON_DATA_IN_URL'}) - too much?
I suppose you could offer the “native application” option to users willing to install one. Unfortunately, it’s not an optional permission. That makes it less appealing.
I don’t know if there is a dead-simple cross-platform native messaging file system interface developers can adopt. This one seems to require npm to install (maybe that is only for the developer, not the user?):
doesn’t think about making backups unless disaster happens
That’s not thinking about making a backup, that is wishing you had made one
I really like the bookmark Idea. Some things to consider:
use a descriptive title
escape the JSON data for use in a URL (lest you are not able to read stuff following a literal #)
base64 is fast and the output size is ok for JSON control chars (":,), but the build-in btoa doesn’t handle all unicode unless you re-encode the string first (atob(btoa('😄')) => )
encodeURIComponent is made for this, but JSON control chars and unicode will be percent-encoded, which is inefficient and ugly ":,😄 => %22%3A%2C%F0%9F%98%84
place a (non-localized) keyword in either title or probably better the URL for later lookup (and don’t escape it)