import { Writable } from "node:stream";
import { toUint8Array } from "@smithy/core/serde";
export class HashCalculator extends Writable {
    hash;
    constructor(hash, options) {
        super(options);
        this.hash = hash;
    }
    _write(chunk, encoding, callback) {
        try {
            this.hash.update(toUint8Array(chunk));
        }
        catch (err) {
            return callback(err);
        }
        callback();
    }
}
