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

Function applyValidatedStatefulAsyncTransform

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

* Fast path for validated stateful transforms (e.g. compression). * Skips withFlushAsync (transform handles done internally) and * skips isUint8ArrayBatch validation (transform guarantees valid output). * @yields {Uint8Array[]}

(source, transform, options)

Source from the content-addressed store, hash-verified

678 * @yields {Uint8Array[]}
679 */
680async function* applyValidatedStatefulAsyncTransform(source, transform, options) {
681 const output = transform(source, options);
682 for await (const batch of output) {
683 if (batch.length > 0) {
684 yield batch;
685 }
686 }
687 // Check abort after the transform completes - without the
688 // withFlushAsync wrapper there is no extra yield to give
689 // the outer pipeline a chance to see the abort.
690 options.signal?.throwIfAborted();
691}
692
693function getOnAbort(reject, signal) {
694 return () => reject(signal.reason);

Callers 1

createAsyncPipelineFunction · 0.85

Calls 2

throwIfAbortedMethod · 0.80
transformFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…