/** * Stream - Buffered I/O abstraction * * This implementation mirrors the Rust `fitz::stream::Stream` for 100% API compatibility. */ import { Buffer } from './buffer.js'; import { SeekOrigin } from './types.js'; /** * A buffered stream for reading PDF data * * Mirrors the Rust `Stream` implementation. */ export declare class Stream { private readonly source; private readonly buffer; private rp; private wp; private pos; private isEof; private bits; private bitsAvail; private readonly filename; private constructor(); /** * Open a stream from a file path (synchronous) */ static openFileSync(path: string): Stream; /** * Open a stream from a file path (asynchronous) */ static openFile(path: string): Promise; /** * Open a stream from memory */ static openMemory(data: Uint8Array | globalThis.Buffer): Stream; /** * Open a stream from a Buffer */ static openBuffer(buffer: Buffer): Stream; /** * Get the current read position */ tell(): number; /** * Get the total length of the stream if known */ get length(): number | null; /** * Check if the stream is empty */ get isEmpty(): boolean; /** * Check if we've reached EOF */ get eof(): boolean; /** * Get the filename if this is a file stream */ getFilename(): string | null; /** * Fill the internal buffer */ private fillBuffer; /** * Read a single byte */ readByte(): number | null; /** * Peek at the next byte without consuming it */ peekByte(): number | null; /** * Read bytes into a buffer */ read(buf: Uint8Array): number; /** * Read exactly the specified number of bytes */ readExact(buf: Uint8Array): void; /** * Read all remaining data into a Buffer */ readAll(_initialCapacity?: number): Buffer; /** * Read a line (up to and including newline) */ readLine(): Uint8Array | null; /** * Skip n bytes */ skip(n: number): number; /** * Seek to a position in the stream */ seek(offset: number, origin?: SeekOrigin): void; /** * Read a 16-bit unsigned integer (big-endian) */ readUInt16(): number; /** * Read a 24-bit unsigned integer (big-endian) */ readUInt24(): number; /** * Read a 32-bit unsigned integer (big-endian) */ readUInt32(): number; /** * Read a 16-bit signed integer (little-endian) */ readInt16LE(): number; /** * Read a 32-bit signed integer (little-endian) */ readInt32LE(): number; /** * Read a 16-bit unsigned integer (little-endian) */ readUInt16LE(): number; /** * Read a 32-bit unsigned integer (little-endian) */ readUInt32LE(): number; /** * Read n bits from the stream */ readBits(n: number): number; /** * Sync bits - discard any partial byte */ syncBits(): void; } /** * Async stream for non-blocking I/O */ export declare class AsyncStream { private readonly data; private position; private isEof; private constructor(); /** * Open a file asynchronously */ static openFile(path: string): Promise; /** * Open from memory */ static openMemory(data: Uint8Array | globalThis.Buffer): AsyncStream; /** * Read bytes asynchronously */ read(buf: Uint8Array): Promise; /** * Read all data asynchronously */ readAll(): Promise; /** * Seek asynchronously */ seek(offset: number, origin?: SeekOrigin): Promise; /** * Get current position */ tell(): number; /** * Check if EOF */ get eof(): boolean; /** * Get length */ get length(): number; } //# sourceMappingURL=stream.d.ts.map