/** * A growable byte sink. * * Encoders rarely know their exact output size up front — a WAV header is fixed * but a VBR MP3 frame is not — so this grows geometrically and hands back a * single exact-length `Uint8Array` at the end. * * Growth doubles rather than incrementing, which keeps the amortised cost of an * append at O(1); the naive "allocate exactly what's needed each time" pattern is * quadratic and is the reason several JS encoders are slower than they look. */ export declare class Writer { private buf; private view; private len; constructor(initialCapacity?: number); /** Number of bytes written so far. */ get length(): number; private grow; /** * Reserves `n` bytes at the current position and returns their offset. * * Used for fields that can only be filled in later — a RIFF chunk size is not * known until its contents have been written. Pair with {@link patchU32}. */ reserve(n: number): number; /** Overwrites a previously reserved 32-bit slot. */ patchU32(offset: number, value: number, littleEndian: boolean): void; u8(v: number): void; i8(v: number): void; u16(v: number, littleEndian: boolean): void; i16(v: number, littleEndian: boolean): void; u24(v: number, littleEndian: boolean): void; u32(v: number, littleEndian: boolean): void; i32(v: number, littleEndian: boolean): void; u64(v: number, littleEndian: boolean): void; f32(v: number, littleEndian: boolean): void; f64(v: number, littleEndian: boolean): void; /** Writes an 80-bit IEEE 754 extended float. AIFF sample rates only. */ f80(value: number): void; /** Writes a string as Latin-1, optionally padded with spaces to a fixed width. */ ascii(s: string, padTo?: number): void; /** Appends raw bytes. */ write(data: Uint8Array): void; /** Appends `n` zero bytes. */ zeros(n: number): void; /** Writes a single pad byte if the length is odd, as RIFF and IFF require. */ align2(): void; /** Returns an exact-length copy of everything written. */ finish(): Uint8Array; }