Hacker News new | ask | show | jobs
by h-cobordism 2248 days ago
Does HTML5 even let you read a file without loading it all into memory?

Edit: Looks like this is it. https://developer.mozilla.org/en-US/docs/Web/API/ReadableStr...

Edit 2: And yes, this is using it. https://github.com/saljam/webwormhole/blob/master/web/main.j...

3 comments

You can also do this manually (and on older browsers) by creating a FileReader and only loading new chunks after old ones have been transferred. With async APIs like WebSockets and WebRTC this typically requires implementing your own backpressure to avoid blowing up browser memory. See for example how omnistreams does it[0].

[0]: https://github.com/omnistreams/omnistreams-filereader-js/blo...

Hm, apparently what you found is something else (i.e. https://github.com/saljam/webwormhole/issues/5).

There is still an open bug for large file transfers: https://github.com/saljam/webwormhole/issues/4

That's great! Inconsistent large file support has also been what has prevented me from using the various predecessors to this so far.