We are trying to build a stream encrypting flow that takes a video file (+ 1GB) from disk, encrypts it, and uploads it to a server. It seems to be that there is simply no way to do this without loading the full file into memory first.
Looking at Fetch it can support a ReadableStream in the request body. But the browser compatibility isn't good enough: https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#browser_compatibility.
At the moment the upload happens from plain file input, of which we take the stream File.stream()
, encrypt it with a custom TransformStream and AES-CBC, but then what? How to get a Readable Stream directly uploaded with Fetch/XHR?
Does anyone have any examples or ideas to do this without loading the file in memory?