Create a TransformStream that computes a hash digest.
Each input chunk is fed to the incremental hasher. On flush, a HashStreamResult containing the hex digest and algorithm name is emitted.
The hash algorithm to use.
A TransformStream that accepts Uint8Array chunks and emits a HashStreamResult.
const stream = createHashStream("sha256");const writer = stream.writable.getWriter();await writer.write(new TextEncoder().encode("hello"));await writer.close();const reader = stream.readable.getReader();const { value } = await reader.read();console.log(value.digest); // hex string Copy
const stream = createHashStream("sha256");const writer = stream.writable.getWriter();await writer.write(new TextEncoder().encode("hello"));await writer.close();const reader = stream.readable.getReader();const { value } = await reader.read();console.log(value.digest); // hex string
Create a TransformStream that computes a hash digest.
Each input chunk is fed to the incremental hasher. On flush, a HashStreamResult containing the hex digest and algorithm name is emitted.