import crypto from 'node:crypto'; import { Transform } from 'node:stream'; import type { TransformCallback } from 'node:stream'; /** * The object StreamHash records its results on. */ export interface HashTarget { checksum?: string; size?: number; } /** * A pass-through stream that records the checksum and byte size of what flows through it on the * given object once the stream ends. Throws when the hash algorithm is not available. With `algo` * set to `false` nothing is hashed and only the size is recorded. */ declare class StreamHash extends Transform { attachment: HashTarget; algo: string | false; hash: crypto.Hash | null; byteCount: number; constructor(attachment: HashTarget, algo?: string | false); _transform(chunk: Buffer, encoding: BufferEncoding, done: TransformCallback): void; _flush(done: TransformCallback): void; } export default StreamHash;