Reference

@reckona/mreact-server/buffer-sink

6 public exports.

Function

FunctioncreateBufferSinkfunction createBufferSink(options: BufferSinkOptions): BufferSinkCreates a Node-only buffer sink with a single pre-allocated growing backing `Buffer`.FunctioncreateStreamingBufferSinkfunction createStreamingBufferSink(options: StreamingBufferSinkOptions): StreamingBufferSinkCreates a streaming sink that coalesces appended text into byte buffers.

Interface

InterfaceBufferSinkinterface BufferSinkAccumulates server-rendered chunks into a Node Buffer.InterfaceBufferSinkOptionsinterface BufferSinkOptionsOptions controlling allocation and growth for a Node buffer sink.InterfaceStreamingBufferSinkinterface StreamingBufferSinkA streaming-flavored buffer sink used by `renderToReadableStream`. Coalesces successive `append(chunk)` calls into a single byte buffer, then hands the buffer to a consumer callback either on demand (`flush()`) or automatically once the accumulated UTF-8 byte length crosses a threshold. The contract: - Each call to `flush()` (or an auto-flush triggered from within `append`) delivers **exactly one** non-empty byte buffer to the consumer. Empty buffers are never delivered — callers do not need to filter them out. - The delivered buffer is exclusively owned by the consumer; the sink will not mutate it afterwards. Internally we allocate a fresh backing buffer per epoch, so handing off a `subarray` view is safe with no copy. Issue 084: motivated by the streaming SSR throughput gap to marko-run (mreact was at 0.66x marko's ops/sec because the previous implementation paid a `TextEncoder.encode` + Web Streams `controller.enqueue` round-trip per `sink.append()` call).InterfaceStreamingBufferSinkOptionsinterface StreamingBufferSinkOptionsOptions controlling automatic flush behavior for a streaming buffer sink.