MCPcopy Create free account
hub / github.com/Stuk/jszip / NodejsStreamOutputAdapter

Function NodejsStreamOutputAdapter

lib/nodejs/NodejsStreamOutputAdapter.js:16–35  ·  view source on GitHub ↗

* A nodejs stream using a worker as source. * @see the SourceWrapper in http://nodejs.org/api/stream.html * @constructor * @param {StreamHelper} helper the helper wrapping the worker * @param {Object} options the nodejs stream options * @param {Function} updateCb the update callback.

(helper, options, updateCb)

Source from the content-addressed store, hash-verified

14* @param {Function} updateCb the update callback.
15*/
16function NodejsStreamOutputAdapter(helper, options, updateCb) {
17 Readable.call(this, options);
18 this._helper = helper;
19
20 var self = this;
21 helper.on("data", function (data, meta) {
22 if (!self.push(data)) {
23 self._helper.pause();
24 }
25 if(updateCb) {
26 updateCb(meta);
27 }
28 })
29 .on("error", function(e) {
30 self.emit("error", e);
31 })
32 .on("end", function () {
33 self.push(null);
34 });
35}
36
37
38NodejsStreamOutputAdapter.prototype._read = function() {

Callers

nothing calls this directly

Calls 2

onMethod · 0.80
pauseMethod · 0.80

Tested by

no test coverage detected