UNPKG

serverless-spy

Version:

CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.

18 lines (17 loc) 430 B
import { toUint8Array } from "@smithy/util-utf8"; import { Writable } from "stream"; export class HashCalculator extends Writable { constructor(hash, options) { super(options); this.hash = hash; } _write(chunk, encoding, callback) { try { this.hash.update(toUint8Array(chunk)); } catch (err) { return callback(err); } callback(); } }