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

Method enqueue

packages/react-router-node/stream.ts:262–287  ·  view source on GitHub ↗
(chunk: Uint8Array | string)

Source from the content-addressed store, hash-verified

260 }
261
262 enqueue(chunk: Uint8Array | string) {
263 if (this.controller) {
264 try {
265 let bytes: Uint8Array<ArrayBuffer> =
266 typeof chunk === "string"
267 ? Buffer.from(chunk)
268 : new Uint8Array(chunk);
269
270 let available = (this.controller.desiredSize || 0) - bytes.byteLength;
271 this.controller.enqueue(bytes);
272 if (available <= 0) {
273 this.pause();
274 }
275 } catch (
276 // eslint-disable-next-line @typescript-eslint/no-unused-vars
277 e
278 ) {
279 this.controller.error(
280 new Error(
281 "Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object",
282 ),
283 );
284 this.cancel();
285 }
286 }
287 }
288
289 pause() {
290 if (this.stream.pause) {

Callers 11

startFunction · 0.80
transformFunction · 0.80
startFunction · 0.80
flushFunction · 0.80
handleChunkFunction · 0.80
flushBufferedChunksFunction · 0.80
flushFunction · 0.80
writeChunkFunction · 0.80
startFunction · 0.80
startFunction · 0.80

Calls 3

pauseMethod · 0.95
cancelMethod · 0.95
errorMethod · 0.80

Tested by 1

startFunction · 0.64