Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localStorage not suited for storing binary data like e.g. images #144

Closed
raucao opened this issue Nov 5, 2012 · 5 comments
Closed

localStorage not suited for storing binary data like e.g. images #144

raucao opened this issue Nov 5, 2012 · 5 comments
Labels
Milestone

Comments

@raucao
Copy link
Member

raucao commented Nov 5, 2012

We have a big problem with using localStorage for caching everything at the moment. When storing/syncing even just a couple of images, the storage limit is exceeded in most browsers and throws an exception, causing syncing to fail.

We either need a fundamental change in how remoteStorage.js caches data, or at least an exception with how it caches (or maybe not caches) binary data.

The first solution I could think of is IndexedDB. It has native support for storing blobs, and it doesn't have a global lock on every operation. Its size limit is much larger, and Firefox e.g. just asks for permission if you need more than 50MB.

As we need CORS anyway, almost all currently compatible browsers should also support IndexedDB.

It's really important, that we fix this very soon. It's basically impossible to use binary data in a real-world application at the moment. And even for other types of data, localStorage will not scale to what a lot of apps need. At least not if the default mode is to sync all data all the time.

@nilclass
Copy link
Member

nilclass commented Nov 5, 2012

I agree. localStorage is not suitable. Especially for binary data which is being bloated by base64 encoding.

I will check what needs to be changed to switch to indexedDB.

@xMartin
Copy link
Member

xMartin commented Nov 5, 2012

@silverbucket
Copy link
Member

I have been wondering about this for some time now, but have yet to use
remoteStorage for anything substantial yet. I'm completely for moving to
IndexedDB too.
With the remoteStorage.js API, whether we use localStorage or IndexedDB (or
something new in the future), it will remain abstracted from the
application developers. This could be a huge plus for us in developer
adoption down the road. Just a thought.

On Mon, Nov 5, 2012 at 2:07 PM, xMartin notifications@github.com wrote:

Maybe an interesting input:
http://hacks.mozilla.org/2012/03/there-is-no-simple-solution-for-local-storage/


Reply to this email directly or view it on GitHubhttps://github.com//issues/144#issuecomment-10069718.

@nilclass
Copy link
Member

nilclass commented Nov 5, 2012

I've put this issue on the remotestorage.io list for discussion: remotestorage/remotestorage.io#17

@nilclass
Copy link
Member

indexedDB adapter is implemented. Fallback currently is still localStorage, if indexedDB is not available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants