1

I have a situation where I am dealing with very large files and trying to encrypt them. I am running into a problem in the browser where the browser is running out of memory and so is crashing.

I was hoping to try and offload some of the larger objects/data to a local cache on disk to take these out of memory to help with this.

I've seen the CacheAPI which I thought may help, but this seems to only handle storing requests, whereas I am really dealing with arrays of bytes and objects that I want to store somewhere.

https://web.dev/cache-api-quick-guide/

Is there anything else I can use to support this, I need to support modern browsers so not IE.

2
  • Maybe another approach would be to ask if you really need to handle objects and arrays so large that they overflow the computer's memory? Isn't streaming a solution? Chunking? Commented Jun 2, 2020 at 10:46
  • I am chunking before and after the encryption, the issue I have is with the encryption as I can't encrypt in chunks and send up to the server before I go to the next chunk I need to encrypt the whole thing at once. Commented Jun 2, 2020 at 10:48

1 Answer 1

2

You can try indexedDB - it supports the data you need.

https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

localStorage size is 5000KB only, when it comes to IndexedDB you are limited by the disk space.

Sign up to request clarification or add additional context in comments.

3 Comments

Ahh this sounds like it could be perfect... I will give it a go this afternoon
let me know if it helps:)
It didn't work out, maybe it was me but I couldn't get it to work with large byte arrays, it just kept crashing the browser every time I tried to add a row

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.