@lazarv/react-server/rsc
Low-level RSC serialization helpers — serialize and deserialize React server component payloads directly. Most apps should not need these.
function fromBuffer<T = unknown, O = unknown>(value: Uint8Array, options?: O): Promise<T>;
Deserialize a buffer as a React component.
Parameters
value— The buffer to deserialize.options— Options for the deserialization.
Returns — A promise that resolves to the deserialized React component.
function fromStream<T = unknown, O = unknown>(stream: ReadableStream<Uint8Array>, options?: O): Promise<T>;
Deserialize a ReadableStream as a React component.
Parameters
stream— The ReadableStream to deserialize.options— Options for the deserialization.
Returns — A promise that resolves to the deserialized React component.
function toBuffer<T, O>(model: T, options?: O): Promise<Uint8Array>;
Serialize a React component into a buffer.
Parameters
model— The React component to serialize.options— Options for the serialization.
Returns — A promise that resolves to a buffer containing the serialized component.
function toStream<T, O>(model: T, options?: O): Promise<ReadableStream<Uint8Array>>;
Serialize a React component to a ReadableStream.
Parameters
model— The React component to serialize.options— Options for the serialization.
Returns — A promise that resolves to a ReadableStream containing the serialized component.