Crypto Lib
    Preparing search index...

    Function createDecryptStream

    • Create a TransformStream that decrypts what createEncryptStream or streamEncrypt wrote.

      Emits each chunk's plaintext once the chunk has arrived and authenticated. A stream that ends early errors instead of ending normally, but plaintext already emitted is not withdrawn: treat the output as complete only once the stream closes without error. With format: "single-message", it reads the pre-0.0.36 format instead.

      Parameters

      Returns TransformStream<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>

      A TransformStream that accepts ciphertext Uint8Array chunks and emits plaintext.

      const key = "aa".repeat(32);
      await encrypted
      .pipeThrough(createDecryptStream({ key }))
      .pipeTo(writable);