Reputation: 2422
I'm using localForage in my Cordova application.
I want to know the size of the localforage. Basically it is mentioned as 5mb limit. I will have more than 100mb data in my mobile application.
var DefaultConfig = {
description: '',
driver: DefaultDriverOrder.slice(),
name: 'localforage',
// Default DB size is _JUST UNDER_ 5MB, as it's the highest size
// we can use without a prompt.
size: 4980736,
storeName: 'keyvaluepairs',
version: 1.0
};
Size is 4980736 bytes, which is 4.9MB.. If I increase it to 100mb, does it support?
Upvotes: 4
Views: 5127
Reputation: 323
You are not using LocalStorage - that is different from LocalForage. LocalStorage is indeed limited to 5mb by spec - here is a link about those limits that also discusses other options for storing data locally using the browser.
LocalForage is a library you can read about at the link you give, that provides an interface to various other options for storing data in across browser platforms. LocalForage does not use a browser's LocalStorage unless it has to, instead it uses IndexDB, or Web SQL depending on the platform.
Therefore, you cannot predict the max or available size of your LocalForage instance - it depends on the browser and device - but you can define it like you do above. If you allocate too much space, it will fail and you can catch the error.
As of August 2017, I found iPads and iPhones are limited to 50 MB storage whereas on PC desktop browsers, and Android, you can definitely allocate and use 100+ MB.
UPDATE October 2018, a developer I work with discovered the IOS limitation is no longer in place using the latest IOS versions, as of earlier this year (about May). So you can now store more than 50MB on IOS in the browser, which is really nice.
Upvotes: 18