@push.rocks/smarthash
Version:
Cross-environment hash functions (SHA256 and MD5) for Node.js and browsers, with support for strings, streams, and files.
15 lines (11 loc) • 364 B
text/typescript
import * as plugins from './nodehash.plugins.js';
export const hashStreamPipeStop = (resolveFunctionArg: (inputArg: string) => any) => {
const forEach = (chunk: Buffer, enc: any, cb: any) => {
resolveFunctionArg(chunk.toString('utf8'));
cb(null, chunk);
};
const atEnd = (cb: any) => {
cb();
};
return plugins.through2(forEach, atEnd);
};