igir
Version:
🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
30 lines (29 loc) • 712 B
JavaScript
import stream from "node:stream";
class SkipBytesTransform extends stream.Transform {
remaining;
constructor(count) {
super();
this.remaining = count;
}
/**
* Pass through bytes after the leading `count` bytes have been dropped.
*/
_transform(chunk, _encoding, callback) {
if (this.remaining > 0) {
if (chunk.length <= this.remaining) {
this.remaining -= chunk.length;
callback();
return;
}
const sliced = chunk.subarray(this.remaining);
this.remaining = 0;
callback(void 0, sliced);
return;
}
callback(void 0, chunk);
}
}
export {
SkipBytesTransform as default
};
//# sourceMappingURL=skipBytesTransform.js.map