export type StreamBufferType = ArrayBufferLike | DataView; /** * KaitaiStream is an implementation of Kaitai Struct API for JavaScript. * * It's based on KaitaiStream.js - https://github.com/kaitai-io/kaitai_struct_javascript_runtime/blob/master/KaitaiStream.js that comes with the following license * * @license Copyright 2012-2016 Ilmari Heikkinen Copyright 2016-2020 Kaitai Project licensed under Apache License, Version 2.0 (the "License"); * * Implementation has been translated to Typescript and modified to fit our needs */ export declare abstract class KaitaiStream { /** * @param arrayBuffer ArrayBuffer to read from. * @param byteOffset Offset from arrayBuffer beginning for the KaitaiStream. * @param isBigEndian */ constructor(arrayBuffer?: StreamBufferType, byteOffset?: number, isBigEndian?: boolean); get byteLeft(): number; set pos(v: number); get pos(): number; /** Set/get the backing ArrayBuffer of the KaitaiStream object. The setter updates the DataView to point to the new buffer. @type {Object} */ get buffer(): ArrayBufferLike; get toBytes(): Uint8Array; set buffer(v: ArrayBuffer); get isBigEndian(): boolean; get isLittleEndian(): boolean; /** Set/get the byteOffset of the KaitaiStream object. The setter updates the DataView to point to the new byteOffset. @type {number} */ get byteOffset(): number; set byteOffset(v: number); /** Set/get the backing DataView of the KaitaiStream object. The setter updates the buffer and byteOffset to point to the DataView values. @type {Object} */ get dataView(): DataView; set dataView(v: DataView); /** Returns the byte length of the KaitaiStream object. @type {number} */ get size(): number; static iconvlite: any; static zlib: any; /** Dependency configuration data. Holds urls for (optional) dynamic loading of code dependencies from a remote server. For use by (static) processing functions. Caller should the supported keys to the asset urls as needed. NOTE: `depUrls` is a static property of KaitaiStream (the factory),like the various processing functions. It is NOT part of the prototype of instances. @type {Object} */ static depUrls: { zlib: any | undefined; }; /** Native endianness. Either KaitaiStream.BIG_ENDIAN or KaitaiStream.LITTLE_ENDIAN depending on the platform endianness. @type {boolean} */ static endianness: boolean; protected _byteOffset: number; protected _buffer: ArrayBufferLike; protected _dataView: DataView; protected _pos: number; protected _bitsLeft: number; /** * Number of bits left to read/write for the current byte (when read bit by bit instead of bytes) * Number between 8 and 1 * @deprecated */ get bitsLeft(): number; /** * @deprecated will be removed in future release */ get bits(): number; /** Virtual byte length of the KaitaiStream backing buffer. Updated to be max of original buffer size and last written size. If dynamicSize is false is set to buffer size. @type {number} */ _byteLength: number; _isBigEndian: boolean; static bytesStripRight(data: Uint8Array, padByte: number): Uint8Array; static bytesTerminate(data: Uint8Array, term: number, include?: boolean): Uint8Array; /** * @deprecated will be removed in future major release * @param arr * @param encoding * @returns */ static bytesToStr(arr: Uint8Array, encoding: string): string; /** * @deprecated * @param a * @param b * @returns */ static mod(a: number, b: number): number; /** * @deprecated * @param a * @param b * @returns */ static arrayMin(arr: Uint8Array): number; /** * @deprecated * @param a * @param b * @returns */ static arrayMax(arr: Uint8Array): number; /** * @deprecated * @param a * @param b * @returns */ static byteArrayCompare(a: Uint8Array, b: Uint8Array): number; /** * @deprecated * Creates an array from an array of character codes. Uses String.fromCharCode in chunks for memory efficiency and then concatenates the resulting string chunks. @param {array} array Array of character codes. @return {string} String created from the character codes. */ static createStringFromArray(array: any): string; /** * @deprecated * @param data * @param key * @returns */ static processXorOne(data: Uint8Array, key: number): Uint8Array; /** * @deprecated * @param data * @param key * @returns */ static processXorMany(data: Uint8Array, key: Uint8Array): Uint8Array; /** * @deprecated * @param data * @param amount * @param groupSize * @returns */ static processRotateLeft(data: Uint8Array, amount: number, groupSize: number): Uint8Array; getStreamSize(): number; alignToByte(): void; protected _getBitsFromCurrentPosition(): number; protected _decreaseBitsLeft(val: number): void; /** Internal function to trim the KaitaiStream buffer when required. Used for stripping out the extra bytes from the backing buffer when the virtual byteLength is smaller than the buffer byteLength (happens after growing the buffer with writes and not filling the extra space completely). @return {null} */ _trimAlloc(): void; /** Returns true if the KaitaiStream seek pointer is at the end of buffer and there's no more data to read. @return {boolean} True if the seek pointer is at the end of the buffer. */ isEof(): boolean; forward(relativePosition: number): this; /** Sets the KaitaiStream read/write position to given position. Clamps between 0 and KaitaiStream length. @param {number} pos Position to seek to. @return {null} */ seek(pos: number): void; forwardBits(n: number): this; setBitPosition(bitPosition: number): void; getBitPosition(): number; /** Maps a Uint8Array into the KaitaiStream buffer. Nice for quickly reading in data. @param {number} length Number of elements to map. @return {Object} Uint8Array to the KaitaiStream backing buffer. */ mapUint8Array(length: number): Uint8Array; } export declare class EOFError extends Error { bytesReq: number; bytesAvail: number; constructor(bytesReq: number, bytesAvail: number); } export declare class UnexpectedDataError extends Error { expected: Uint8Array; actual: Uint8Array; constructor(expected: Uint8Array, actual: Uint8Array); } export declare class UndecidedEndiannessError extends Error { constructor(); }