0

I have a situation in my work, where I have to load 800 MB file and send it to the backend. Device running the app will have something about 240 MB of RAM, so probably I can not load the whole file in the browser cause I will get "Out of memory" error. I am trying to find if there's a possible solution to this issue.

Is there a possibility to load file by chunk? Something like:

loadSomehow(fileHandler, { chunk: 1000 }).then(handler => {
  while (!handler.done()) {
    doSomethingWithChunk(handler.nextChunk());
  }
});

Is it even possible to that? I would like to emphasize, that I mean loading file in chunks, not processing it in chunks like in this question. Looks like FileSystemFileHandle's getFile method also returns the whole file at once.

Radek Anuszewski
  • 1,812
  • 8
  • 34
  • 62
  • 1
    If answers in those questions are processing in chunks, then they are probably also loading in chunks. And just because you got a handle to a file, doesn't mean that the whole file was already read. Did you test that? – gre_gor Apr 22 '23 at 16:32

0 Answers0