UNPKG

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.

19 lines (18 loc) • 483 B
import stream from 'node:stream'; /** * A stream transform to calculate the size of a post-compression file. */ export default class CompressedTransform extends stream.Transform { size = 0; /** * Increment the size and passthrough the data. */ _transform(chunk, _encoding, callback) { this.size += chunk.length; // eslint-disable-next-line unicorn/no-null callback(null, chunk); } getSize() { return this.size; } }