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

Function testPipeToSyncSAB

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

Source from the content-addressed store, hash-verified

97// =============================================================================
98
99function testPipeToSyncSAB() {
100 const sab = new SharedArrayBuffer(3);
101 new Uint8Array(sab).set([65, 66, 67]); // 'ABC'
102 const written = [];
103 const writer = {
104 writeSync(chunk) { written.push(chunk); return true; },
105 endSync() { return written.length; },
106 };
107 const totalBytes = pipeToSync(fromSync(sab), writer);
108 assert.strictEqual(totalBytes, 3);
109 assert.deepStrictEqual(written[0], new Uint8Array([65, 66, 67]));
110}
111
112async function testPipeToAsyncSAB() {
113 const sab = new SharedArrayBuffer(3);

Calls 3

pipeToSyncFunction · 0.85
fromSyncFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…