lambda-live-debugger
Version:
Debug Lambda functions locally like it is running in the cloud
19 lines (18 loc) • 440 B
JavaScript
import { toUint8Array } from "@smithy/util-utf8";
import { Writable } from "stream";
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();
}
}