MCPcopy Index your code
hub / github.com/nodejs/node / writeData

Function writeData

test/parallel/test-fastutf8stream-end.js:83–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81
82 let totalWritten = 0;
83 function writeData() {
84 if (totalWritten >= 10000) {
85 stream.end();
86 return;
87 }
88
89 const chunk = str.slice(totalWritten, totalWritten + 1000);
90 if (stream.write(chunk)) {
91 totalWritten += chunk.length;
92 setImmediate(common.mustCall(writeData));
93 } else {
94 stream.once('drain', common.mustCall(() => {
95 totalWritten += chunk.length;
96 setImmediate(common.mustCall(writeData));
97 }));
98 }
99 };
100
101 stream.on('finish', common.mustCall(() => {
102 fs.readFile(dest, 'utf8', common.mustSucceed((data) => {

Callers 1

runTestsFunction · 0.70

Calls 5

sliceMethod · 0.65
setImmediateFunction · 0.50
endMethod · 0.45
writeMethod · 0.45
onceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…