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

Function appendTransformResultAsync

lib/internal/streams/iter/pull.js:407–434  ·  view source on GitHub ↗

* Append normalized transform result batches to an array (async). * @param {Array } target * @param {*} result * @returns {Promise |undefined}

(target, result)

Source from the content-addressed store, hash-verified

405 * @returns {Promise<void>|undefined}
406 */
407function appendTransformResultAsync(target, result) {
408 if (result === null) {
409 return;
410 }
411 if (isUint8ArrayBatch(result)) {
412 if (result.length > 0) {
413 ArrayPrototypePush(target, result);
414 }
415 return;
416 }
417 if (isUint8Array(result)) {
418 ArrayPrototypePush(target, [result]);
419 return;
420 }
421 if (typeof result === 'string') {
422 ArrayPrototypePush(target, [toUint8Array(result)]);
423 return;
424 }
425 if (isAnyArrayBuffer(result)) {
426 ArrayPrototypePush(target, [new Uint8Array(result)]);
427 return;
428 }
429 if (ArrayBufferIsView(result)) {
430 ArrayPrototypePush(target, [arrayBufferViewToUint8Array(result)]);
431 return;
432 }
433 return appendTransformResultAsyncSlow(target, result);
434}
435
436async function appendTransformResultAsyncSlow(target, result) {
437 for await (const batch of processTransformResultAsync(result)) {

Callers 1

Calls 5

isUint8ArrayBatchFunction · 0.85
isUint8ArrayFunction · 0.85
toUint8ArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…