/** * StreamBuf - Minimal Event-Driven Stream Buffer for DOCX Streaming * * A lightweight stream buffer that emits data events when written to. * This is specifically designed for the streaming DOCX writer's needs: * - Write StringBuf or Uint8Array data * - Emit "data" events with Uint8Array chunks * - Emit "finish" on end() * - Support custom event listeners (once/on/emit) * * This is a word-module-local implementation to avoid depending on @excel/utils. */ import { EventEmitter } from "../../../utils/event-emitter.js"; import type { StringBuf } from "./string-buf.js"; interface StreamBufOptions { bufSize?: number; } /** * Minimal streaming buffer for piping XML data to ZIP compression. * Extends EventEmitter for event-driven data flow. */ declare class StreamBuf extends EventEmitter { private _ended; constructor(_options?: StreamBufOptions); /** Returns true if the stream is writable (not ended). */ get writable(): boolean; /** * Write data to the stream. Emits a "data" event with the bytes. */ write(data: Uint8Array | string | StringBuf | ArrayBuffer | ArrayBufferView, _encoding?: string | ((...args: unknown[]) => unknown), callback?: (...args: unknown[]) => unknown): void; /** * End the stream. Emits "finish" event. */ end(chunk?: Uint8Array | string | StringBuf | ArrayBuffer | ArrayBufferView, _encoding?: string, callback?: (...args: unknown[]) => unknown): void; } export { StreamBuf }; export type { StreamBufOptions };