-
I'm trying to download a symmetrically encrypted large file from a webserver and decrypt it. In Node using streams for encryption and decryption works fine w/ any size of files. I use nearly identical code in the browser. It works w/ ~30MB files, but fails w/ ~700MB. I get this exception: 'Error decrypting message: Array buffer allocation failed' async function download () {
const fileStream = streamSaver.createWriteStream('your.img')
const res = await fetch(url)
const bodyStream = res.body
const message = await openpgp.readMessage({binaryMessage: bodyStream})
const decrypted = await openpgp.decrypt({
message,
passwords: pw,
format: 'binary'
})
return decrypted.data.pipeTo(fileStream)
} I suspect readMessage tries to read everything from the stream. How can I avoid it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey 👋 Do you have |
Beta Was this translation helpful? Give feedback.
Hey 👋 Do you have
openpgp.config.allowUnauthenticatedStream
set? (To be fair, I'm not sure why this would only affect web streams, but just to check.) Failing that, the underlying issue you're running into may be the same as #1012. I'm not aware of a workaround, but that thread does contain some hints about where to start looking, if you want to dig into this.