MCPcopy
hub / github.com/remix-run/react-router / waitForDrain

Function waitForDrain

packages/react-router-node/stream.ts:111–130  ·  view source on GitHub ↗
(
  writable: Writable,
  writableError: WritableErrorMonitor,
)

Source from the content-addressed store, hash-verified

109}
110
111function waitForDrain(
112 writable: Writable,
113 writableError: WritableErrorMonitor,
114): Promise<void> {
115 let cleanup = () => {};
116 let drainPromise = new Promise<void>((resolve) => {
117 function onDrain() {
118 cleanup();
119 resolve();
120 }
121
122 cleanup = function cleanup() {
123 writable.off("drain", onDrain);
124 };
125
126 writable.once("drain", onDrain);
127 });
128
129 return writableError.race(drainPromise).finally(cleanup);
130}
131
132export async function writeAsyncIterableToWritable(
133 iterable: AsyncIterable<Uint8Array>,

Callers 2

Calls 1

raceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…