UNPKG

r2-utils-js

Version:

Readium 2 'utils' for NodeJS (TypeScript)

23 lines 864 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CounterPassThroughStream = void 0; var tslib_1 = require("tslib"); var stream_1 = require("stream"); var CounterPassThroughStream = (function (_super) { tslib_1.__extends(CounterPassThroughStream, _super); function CounterPassThroughStream(id) { var _this = _super.call(this) || this; _this.id = id; _this.bytesReceived = 0; return _this; } CounterPassThroughStream.prototype._transform = function (chunk, _encoding, callback) { this.bytesReceived += chunk.length; this.push(chunk); this.emit("progress"); callback(); }; return CounterPassThroughStream; }(stream_1.Transform)); exports.CounterPassThroughStream = CounterPassThroughStream; //# sourceMappingURL=CounterPassThroughStream.js.map