/** * Node.js Stream - Writable * * Extended Writable class with browser-compatible API. */ import { Writable as NodeWritable } from "stream"; import type { WritableStreamOptions, WritableLike } from "../types.js"; /** * Extended Writable options that match browser API * Supports wrapping an existing Node.js stream */ export interface WritableOptions extends WritableStreamOptions { /** Existing Node.js Writable stream to wrap (for API compatibility with browser) */ stream?: NodeWritable; autoDestroy?: boolean; emitClose?: boolean; decodeStrings?: boolean; defaultEncoding?: string; signal?: AbortSignal; write?: (this: Writable, chunk: T, encoding: string, callback: (error?: Error | null) => void) => void; writev?: (this: Writable, chunks: Array<{ chunk: T; encoding: string; }>, callback: (error?: Error | null) => void) => void; final?: (this: Writable, callback: (error?: Error | null) => void) => void; destroy?: (this: Writable, error: Error | null, callback: (error?: Error | null) => void) => void; construct?: (this: Writable, callback: (error?: Error | null) => void) => void; } /** * Unified Writable class - wraps Node.js Writable with browser-compatible API * * Supports the same `{ stream }` option as browser version for wrapping existing streams. */ export declare class Writable extends NodeWritable { /** * Duck-typing check so that native Duplex/Transform (which extend native * stream.Writable, not our wrapper) pass `instanceof Writable`. */ static [Symbol.hasInstance](instance: unknown): boolean; constructor(options?: WritableOptions); } /** * Normalize a user-provided writable into a Node.js-compatible Writable. * * This keeps Web/Node branching at the stream-module boundary. */ export declare function toWritable(stream: WritableLike | WritableStream | NodeWritable): WritableLike;