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

Function testBasicWrite

test/parallel/test-stream-iter-writable-interop.js:46–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44// =============================================================================
45
46async function testBasicWrite() {
47 const chunks = [];
48 const writable = new Writable({
49 write(chunk, encoding, cb) {
50 chunks.push(Buffer.from(chunk));
51 cb();
52 },
53 });
54
55 const writer = fromWritable(writable, { backpressure: 'block' });
56 await pipeTo(from('hello world'), writer);
57
58 assert.strictEqual(Buffer.concat(chunks).toString(), 'hello world');
59}
60
61// =============================================================================
62// write() resolves when no backpressure (strict)

Calls 5

fromWritableFunction · 0.85
pipeToFunction · 0.85
concatMethod · 0.80
fromFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…