import { CUSTOM_INSPECT, InspectOptions } from "./inspect.mjs"; import { isF16 } from "./half.mjs"; //#region src/readableStream.d.ts interface DataViewReadableStreamOptions { /** * How many bytes to allocate for each chunk? Best case is that this number * is larger than your final size, so only one allocation has to happen and * no copies on read. * @default 4096 */ chunkSize?: number; /** * If true, Uint8Arrays passed in to write() will always have their current * state copied into the writer, even if they are larger than chunkSize. * @default false */ copyBuffers?: boolean; /** * Do all reads as littleEndian, instead of network byte order (big endian). */ littleEndian?: boolean; /** * Custom queueing strategy. */ queuingStrategy?: QueuingStrategy | null; } type RequiredDataViewReadableStreamOptions = Required; /** * Write bytes to a growing buffer. Intended for relatively-small final * buffer sizes; everything is held in memory. */ declare class DataViewReadableStream extends ReadableStream { #private; static defaultOptions: RequiredDataViewReadableStreamOptions; private constructor(); get littleEndian(): boolean; set littleEndian(value: boolean); static create(options?: DataViewReadableStreamOptions): Promise; /** * Destructively read all bytes from the reader as a single buffer. * * @returns Bytes. */ read(): Promise; /** * Write an arbitrarily-large amount of data to the writer. If this buffer * is larger than chunkSize, it is appended directly -- see the copyBuffers * option for what should happen in this case. If the buffer is less than * the chunkSize + 8 bytes, the buffer is always copied, since it might be * worth writing some more data into that same chunk later. * * @param buf Bytes to write. * @param copy Override the copyBuffers option if specified. * @returns This, for chaining. */ bytes(buf: Uint8Array, copy?: boolean): this; /** * Write a single unsigned byte. * * @param n Byte. * @returns This, for chaining. */ u8(n: number): this; /** * Write a two-byte unsigned integer. * * @param n Unsigned short int. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ u16(n: number, littleEndian?: boolean): this; /** * Write a four-byte unsigned integer. * * @param n Unsigned int. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ u32(n: number, littleEndian?: boolean): this; /** * Write an eight-byte unsigned integer. * * @param n Unsigned long long. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ u64(n: bigint | number, littleEndian?: boolean): this; /** * Write a signed byte. * * @param n Signed byte. * @returns This, for chaining. */ i8(n: number): this; /** * Write a signed two-byte integer. * * @param n Signed short int. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ i16(n: number, littleEndian?: boolean): this; /** * Write a signed four-byte integer. * * @param n Signed int. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ i32(n: number, littleEndian?: boolean): this; /** * Write an eight-byte signed integer. * * @param n Signed long long. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ i64(n: bigint | number, littleEndian?: boolean): this; /** * Write a two-byte float. * * @param n Number that fits in a short float without losing precision. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. * @throws {RangeError} If number would lose precision on write. */ f16(n: number, littleEndian?: boolean): this; /** * Write a four-byte float. * * @param n Number that fits in a float. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. * @throws {RangeError} Would lose precision. */ f32(n: number, littleEndian?: boolean): this; /** * Write an eight-byte integer. * * @param n Double. * @param littleEndian Override stream's littleEndian option. * @returns This, for chaining. */ f64(n: number, littleEndian?: boolean): this; /** * Encode the string as UTF8. * * @param s String. If there are unpaired surrogates, they will be switched * to the replacement character. * @returns This, for chaining. */ utf8(s: string): this; /** * Convert a string to ASCII bytes. * * @param s Latin-1 string. * @returns This, for chaining. * @throws {RangeError} Character not in 0-256. */ ascii(s: string): this; /** * Usually, chunks will be only become available to be read after chunkSize * bytes have been written. Flush forces whatever is currently queued into * the readable stream. * * @returns This, for chaining. */ flush(): this; /** * No more data will be written. Flush everything that is pending. * * @returns This, for chaining. */ end(): this; /** * When outputting with `console.log('%O', this)` or at the node REPL, * see the current chunk structure. * * @param depth Current depth. * @param options Options for writing, generated by util.inpect. * @returns Formatted string. */ [CUSTOM_INSPECT](depth: number, options: InspectOptions): string; } //#endregion export { DataViewReadableStream, DataViewReadableStreamOptions, RequiredDataViewReadableStreamOptions, isF16 };