initial commit

This commit is contained in:
dude
2026-09-01 18:33:56 +00:00
commit c24449ee0a
2761 changed files with 302737 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _stream = require('stream');
class SizeStream extends _stream.Transform {
constructor(cb) {
super({ objectMode: true });
this.streamSize = 0;
this.cb = cb;
}
_transform(chunk, encoding, cb) {
if (this.cb) return this._transformCb(chunk, encoding, cb);
// Update hash sum objects
this.streamSize = this.streamSize + chunk.length;
cb();
}
_flush(cb) {
if (this.cb) return this._flushCb(cb);
const size = this.streamSize;
this.push({ size });
cb(null);
}
_transformCb(chunk, encoding, cb) {
this.streamSize = this.streamSize + chunk.length;
cb(null, chunk);
}
_flushCb(cb) {
const size = this.streamSize;
this.cb(size);
cb(null);
}
}
exports.default = SizeStream;