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

Function testWriteNoDrain

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

Source from the content-addressed store, hash-verified

63// =============================================================================
64
65async function testWriteNoDrain() {
66 const chunks = [];
67 const writable = new Writable({
68 highWaterMark: 1024,
69 write(chunk, encoding, cb) {
70 chunks.push(Buffer.from(chunk));
71 cb();
72 },
73 });
74
75 const writer = fromWritable(writable);
76 await writer.write('hello');
77 await writer.write(' world');
78 await writer.end();
79
80 assert.strictEqual(Buffer.concat(chunks).toString(), 'hello world');
81}
82
83// =============================================================================
84// block: write() waits for drain when backpressure is active

Calls 5

fromWritableFunction · 0.85
concatMethod · 0.80
writeMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected