Commenting the scenario just in case of XY problem:
I need to request some json files from my server, but I want to cache them somehow to avoid requesting again.
I can create a json file using download api but there are two problems with this:
- I don't know how to specify a custom folder (I think I could solve this using
chrome.downloads.downloadAPI withsaveAs = true) - I don't know how to read that file (maybe not possible for security reasons?) https://developer.chrome.com/extensions/downloads
I was thinking maybe is possible to write in my chrome extension folder, because we can read files from there, but I couldn't find how to do it, I've found a comment saying is not possible, but is from 2011, maybe there is some way to solve this now?
I could try also saving it with chrome.storage, but my json are really big, 3MB each one and I have more than 100, not sure if chrome.storage can manage that without problems, it says 5MB here: https://developer.chrome.com/apps/storage#property-local but we can add unlimitedStorage permission to avoid that limit, the problem is I'm not sure how safe will be this, and maybe there is a better solution.
file://*/*permission or<all_urls>, so you can use the standard XHR/fetch with a standard file:// URL to your file.