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

Function push

lib/internal/streams/iter/push.js:696–717  ·  view source on GitHub ↗

* Create a push stream with optional transforms. * @param {...(Function|object)} args - Transforms, then options (optional) * @returns {{ writer: Writer, readable: AsyncIterable }}

(...args)

Source from the content-addressed store, hash-verified

694 * @returns {{ writer: Writer, readable: AsyncIterable<Uint8Array[]> }}
695 */
696function push(...args) {
697 const { transforms, options } = parseArgs(args);
698
699 const queue = new PushQueue(options);
700 const writer = new PushWriter(queue);
701 const rawReadable = createReadable(queue);
702
703 // Apply transforms lazily if provided
704 let readable;
705 if (transforms.length > 0) {
706 if (options.signal) {
707 readable = pullWithTransforms(
708 rawReadable, ...transforms, { __proto__: null, signal: options.signal });
709 } else {
710 readable = pullWithTransforms(rawReadable, ...transforms);
711 }
712 } else {
713 readable = rawReadable;
714 }
715
716 return { __proto__: null, writer, readable };
717}
718
719module.exports = {
720 push,

Callers 2

duplexFunction · 0.70
benchIterFunction · 0.50

Calls 2

parseArgsFunction · 0.70
createReadableFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…