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

Function testPipeTo

test/parallel/test-stream-iter-pipeto.js:24–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24async function testPipeTo() {
25 const written = [];
26 const writer = {
27 async write(chunk) { written.push(chunk); },
28 async end() { return written.length; },
29 async fail() {},
30 };
31
32 const totalBytes = await pipeTo(from('async-pipe-data'), writer);
33 assert.strictEqual(totalBytes, 15); // 'async-pipe-data' = 15 UTF-8 bytes
34 assert.ok(written.length > 0);
35}
36
37async function testPipeToPreventClose() {
38 let endCalled = false;

Callers 1

Calls 3

pipeToFunction · 0.85
fromFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…