I am developing ionic 2 app that downloads files from online servers, I want to store those files to the local storage (or caches I don't know).
I know that I can store data to local storage using:
localStorage.setItem('key','value');
But if it is file and specially a large one, how to store it in local storage?
Note: I am using TypeScript.
For storing relatively large data, I'd recommend using IndexedDB.
Advantages over local storage:
Browsers have limitation on how much data you can store in local storage. It varies from browser to browser.
If your file size is under the limit, you could copy the file content as a string and save it as a key value pair of "filename":"file content"