smarthash/ts/nodehash.helpers.ts

15 lines
314 B
TypeScript
Raw Normal View History

2022-06-26 09:34:09 +00:00
import * as plugins from './nodehash.plugins.js';
2016-08-16 01:37:40 +00:00
2020-10-05 15:07:28 +00:00
export const hashStreamPipeStop = (resolveFuntion) => {
2019-07-04 14:56:37 +00:00
const forEach = (chunk: Buffer, enc, cb) => {
resolveFuntion(chunk.toString('utf8'));
cb(null, chunk);
};
2016-08-16 01:37:40 +00:00
2020-10-05 15:07:28 +00:00
const atEnd = (cb) => {
cb();
};
2016-08-16 01:37:40 +00:00
return plugins.through2(forEach, atEnd);
};