decryptStream(passphrase)
Decrypts a readable stream
Argument
Type
Description
Required
passphrase
String
Your decryption passphrase
Yes
Example using an already encrypted file from local disk
This example will save the file to local disk in a stream. This code is to be used within your local application
function decryptFile(passphrase) {
//Get the encrypted file from the html input element
//This will not start reading the file, it will only get a reference to it.
const fileInput = document.getElementById('fileInput');
//Convert to stream
const fileStream = file.stream();
//Setup the File API save file picker
const fileHandle = await window.showSaveFilePicker({
suggestedName: `${fileName}`,
startIn: "downloads",
});
//Setting up pipeline
const writable = await fileHandle.createWritable();
const decryptStream = await secure.decryptStream(passphrase);
//Start the pipeline
await fileStream.pipeThrough(decryptStream).pipeTo(writable);
}Example using a encrypted file from a S3 bucket
Last updated