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

Function testPipeToAsyncSAB

test/parallel/test-stream-iter-sharedarraybuffer.js:112–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112async function testPipeToAsyncSAB() {
113 const sab = new SharedArrayBuffer(3);
114 new Uint8Array(sab).set([65, 66, 67]); // 'ABC'
115 const written = [];
116 const writer = {
117 async write(chunk) { written.push(chunk); },
118 async end() { return written.length; },
119 };
120 await pipeTo(from(sab), writer);
121 assert.deepStrictEqual(written[0], new Uint8Array([65, 66, 67]));
122}
123
124// =============================================================================
125// pull / pullSync with SAB-yielding generator

Calls 3

pipeToFunction · 0.85
fromFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…