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
+34
View File
@@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _stream = require('stream');
// Discards "bytesToDiscard" bytes
class DiscardStream extends _stream.Transform {
constructor() {
let bytesToDiscard = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
super();
this.bytesToDiscard = bytesToDiscard;
this.byteCount = 0;
this.done = false;
}
_transform(chunk, encoding, cb) {
if (this.done) return cb(null, chunk);
this.byteCount += chunk.length;
if (this.byteCount > this.bytesToDiscard) {
this.done = true;
const bytesToKeep = this.byteCount - this.bytesToDiscard;
const firstChunk = chunk.slice(-bytesToKeep);
return cb(null, firstChunk);
}
cb(null);
}
}
exports.default = DiscardStream;