MCPcopy
hub / github.com/di-sukharev/opencommit / "node_modules/delayed-stream/lib/delayed_stream.js"

Function "node_modules/delayed-stream/lib/delayed_stream.js"

out/cli.cjs:15490–15576  ·  view source on GitHub ↗
(exports2, module2)

Source from the content-addressed store, hash-verified

15488// node_modules/delayed-stream/lib/delayed_stream.js
15489var require_delayed_stream = __commonJS({
15490 "node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
15491 var Stream3 = require("stream").Stream;
15492 var util4 = require("util");
15493 module2.exports = DelayedStream;
15494 function DelayedStream() {
15495 this.source = null;
15496 this.dataSize = 0;
15497 this.maxDataSize = 1024 * 1024;
15498 this.pauseStream = true;
15499 this._maxDataSizeExceeded = false;
15500 this._released = false;
15501 this._bufferedEvents = [];
15502 }
15503 util4.inherits(DelayedStream, Stream3);
15504 DelayedStream.create = function(source, options) {
15505 var delayedStream = new this();
15506 options = options || {};
15507 for (var option in options) {
15508 delayedStream[option] = options[option];
15509 }
15510 delayedStream.source = source;
15511 var realEmit = source.emit;
15512 source.emit = function() {
15513 delayedStream._handleEmit(arguments);
15514 return realEmit.apply(source, arguments);
15515 };
15516 source.on("error", function() {
15517 });
15518 if (delayedStream.pauseStream) {
15519 source.pause();
15520 }
15521 return delayedStream;
15522 };
15523 Object.defineProperty(DelayedStream.prototype, "readable", {
15524 configurable: true,
15525 enumerable: true,
15526 get: function() {
15527 return this.source.readable;
15528 }
15529 });
15530 DelayedStream.prototype.setEncoding = function() {
15531 return this.source.setEncoding.apply(this.source, arguments);
15532 };
15533 DelayedStream.prototype.resume = function() {
15534 if (!this._released) {
15535 this.release();
15536 }
15537 this.source.resume();
15538 };
15539 DelayedStream.prototype.pause = function() {
15540 this.source.pause();
15541 };
15542 DelayedStream.prototype.release = function() {
15543 this._released = true;
15544 this._bufferedEvents.forEach(function(args) {
15545 this.emit.apply(this, args);
15546 }.bind(this));
15547 this._bufferedEvents = [];

Callers

nothing calls this directly

Calls 5

resumeMethod · 0.80
onMethod · 0.45
forEachMethod · 0.45
pushMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…