MCPcopy Create free account
hub / github.com/nodejs/node / readStart

Method readStart

test/fixtures/wpt/streams/resources/rs-utils.js:52–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 readStart() {
53 if (this.closed) {
54 return;
55 }
56
57 if (!this.started) {
58 this._intervalHandle = localSetInterval(writeChunk, 2);
59 this.started = true;
60 }
61
62 if (this.paused) {
63 this._intervalHandle = localSetInterval(writeChunk, 2);
64 this.paused = false;
65 }
66
67 const source = this;
68 function writeChunk() {
69 if (source.paused) {
70 return;
71 }
72
73 source.pushed++;
74
75 if (source.toPush > 0 && source.pushed > source.toPush) {
76 if (source._intervalHandle) {
77 localClearInterval(source._intervalHandle);
78 source._intervalHandle = undefined;
79 }
80 source.closed = true;
81 source.onend();
82 } else {
83 source.ondata(randomChunk(128));
84 }
85 }
86 }
87
88 readStop() {
89 if (this.paused) {

Callers 5

workerFunction · 0.45
pullFunction · 0.45
pullFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected