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

Function pull

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

* Create an async pull-through pipeline with transforms. * @param {Iterable|AsyncIterable} source - The streamable source * @param {...(Function|object)} args - Transforms, with optional PullOptions * as last argument * @returns {AsyncIterable }

(source, ...args)

Source from the content-addressed store, hash-verified

895 * @returns {AsyncIterable<Uint8Array[]>}
896 */
897function pull(source, ...args) {
898 const { transforms, options } = parsePullArgs(args);
899 const signal = options?.signal;
900 if (signal !== undefined) {
901 validateAbortSignal(signal, 'options.signal');
902 // Eagerly check abort at call time per spec
903 if (signal.aborted) {
904 return {
905 __proto__: null,
906 // eslint-disable-next-line require-yield
907 async *[SymbolAsyncIterator]() {
908 throw signal.reason;
909 },
910 };
911 }
912 }
913
914 return {
915 __proto__: null,
916 async *[SymbolAsyncIterator]() {
917 yield* createAsyncPipeline(from(source), transforms, signal);
918 },
919 };
920}
921
922// =============================================================================
923// Public API: pipeTo() and pipeToSync()

Callers

nothing calls this directly

Calls 2

parsePullArgsFunction · 0.85
validateAbortSignalFunction · 0.85

Tested by

no test coverage detected