I am creating a browser extension which retrieves data from a JSON feed. I would like to store this data locally to prevent having to fetch the feed to often. The feed will eventually have over 100 results and the call is made on every new website that is visited, in the end I need an array with the results.
I am not sure at all on how to do this, but I guess (wild guess) that I have two options:
Option 1: Store it all with chrome.storage.sync.set, will I be able to do this with such a large array? And only refresh from feed every week.
or
Option 2: Write my array to a local file containing the entire array. And only refresh from feed every week.
Does anyone have any ideas on how to do this? Are both options actually possible? Which would be best?
You can use https://developer.chrome.com/extensions/storage to save your data. Usually the local storage is enough. Sync is used when you need to sync saved data across different user profile instances (when user logged in chrome with same account on desktop and notebook for example)
Also you can store data via file using filesystem api or webstorage api like IndexedDB or WebSQL - https://developer.chrome.com/apps/offline_apps.