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

Function testFromAsyncSAB

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

Source from the content-addressed store, hash-verified

34}
35
36async function testFromAsyncSAB() {
37 const sab = new SharedArrayBuffer(4);
38 new Uint8Array(sab).set([10, 20, 30, 40]);
39 const batches = [];
40 for await (const batch of from(sab)) {
41 batches.push(batch);
42 }
43 assert.strictEqual(batches.length, 1);
44 assert.deepStrictEqual(batches[0][0], new Uint8Array([10, 20, 30, 40]));
45}
46
47// =============================================================================
48// Consumers with SAB-backed source

Calls 3

fromFunction · 0.50
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…