ReactServerStreamConfigNode.js — react Source File
Architecture documentation for ReactServerStreamConfigNode.js, a javascript file in the react codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8fe11fda_e242_b3a4_8624_a9eba2b7de8e["ReactServerStreamConfigNode.js"] 84cea5a1_779b_9551_2f54_df77f0973a0f["stream"] 8fe11fda_e242_b3a4_8624_a9eba2b7de8e --> 84cea5a1_779b_9551_2f54_df77f0973a0f e38503ff_90ab_2fd6_8dbb_f5a5a0bd5a1b["util"] 8fe11fda_e242_b3a4_8624_a9eba2b7de8e --> e38503ff_90ab_2fd6_8dbb_f5a5a0bd5a1b 9d39c81d_4e8c_4c68_e6c5_768eba0634d7["crypto"] 8fe11fda_e242_b3a4_8624_a9eba2b7de8e --> 9d39c81d_4e8c_4c68_e6c5_768eba0634d7 style 8fe11fda_e242_b3a4_8624_a9eba2b7de8e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Writable} from 'stream';
import {TextEncoder} from 'util';
import {createHash} from 'crypto';
interface MightBeFlushable {
flush?: () => void;
}
export type Destination = Writable & MightBeFlushable;
export type PrecomputedChunk = Uint8Array;
export opaque type Chunk = string;
export type BinaryChunk = Uint8Array;
export function scheduleWork(callback: () => void) {
setImmediate(callback);
}
export const scheduleMicrotask = queueMicrotask;
export function flushBuffered(destination: Destination) {
// If we don't have any more data to send right now.
// Flush whatever is in the buffer to the wire.
if (typeof destination.flush === 'function') {
// By convention the Zlib streams provide a flush function for this purpose.
// For Express, compression middleware adds this method.
destination.flush();
}
}
// Chunks larger than VIEW_SIZE are written directly, without copying into the
// internal view buffer. This must be at least half of Node's internal Buffer
// pool size (8192) to avoid corrupting the pool when using
// renderToReadableStream, which uses a byte stream that detaches ArrayBuffers.
const VIEW_SIZE = 4096;
let currentView = null;
let writtenBytes = 0;
let destinationHasCapacity = true;
export function beginWriting(destination: Destination) {
currentView = new Uint8Array(VIEW_SIZE);
writtenBytes = 0;
destinationHasCapacity = true;
}
function writeStringChunk(destination: Destination, stringChunk: string) {
if (stringChunk.length === 0) {
return;
}
// maximum possible view needed to encode entire string
// ... (191 more lines)
Dependencies
- crypto
- stream
- util
Source
Frequently Asked Questions
What does ReactServerStreamConfigNode.js do?
ReactServerStreamConfigNode.js is a source file in the react codebase, written in javascript.
What does ReactServerStreamConfigNode.js depend on?
ReactServerStreamConfigNode.js imports 3 module(s): crypto, stream, util.
Where is ReactServerStreamConfigNode.js in the architecture?
ReactServerStreamConfigNode.js is located at packages/react-server/src/ReactServerStreamConfigNode.js (directory: packages/react-server/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free