mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 17:49:16 +02:00
Update Typescript types for 1.1.0
This commit is contained in:
parent
63e84dadb0
commit
3120bba0df
12 changed files with 388 additions and 242 deletions
39
types/archive/decompress.d.ts
vendored
Normal file
39
types/archive/decompress.d.ts
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* Factory method that creates an unarchiver based on the byte signature found
|
||||||
|
* in the arrayBuffer.
|
||||||
|
* @param {ArrayBuffer} ab The ArrayBuffer to unarchive. Note that this ArrayBuffer
|
||||||
|
* must not be referenced after calling this method, as the ArrayBuffer is marked
|
||||||
|
* as Transferable and sent to a Worker thread once start() is called.
|
||||||
|
* @param {Object|string} options An optional object of options, or a string
|
||||||
|
* representing where the path to the unarchiver script files.
|
||||||
|
* @returns {Unarchiver}
|
||||||
|
*/
|
||||||
|
export function getUnarchiver(ab: ArrayBuffer, options?: any | string): Unarchiver;
|
||||||
|
export class Unzipper extends UnzipperInternal {
|
||||||
|
constructor(ab: any, options: any);
|
||||||
|
}
|
||||||
|
export class Unrarrer extends UnrarrerInternal {
|
||||||
|
constructor(ab: any, options: any);
|
||||||
|
}
|
||||||
|
export class Untarrer extends UntarrerInternal {
|
||||||
|
constructor(ab: any, options: any);
|
||||||
|
}
|
||||||
|
export type UnarchivedFile = {
|
||||||
|
filename: string;
|
||||||
|
fileData: Uint8Array;
|
||||||
|
};
|
||||||
|
import { Unarchiver } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveAppendEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveErrorEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveEventType } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveExtractEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveFinishEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveInfoEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveProgressEvent } from "./decompress-internal.js";
|
||||||
|
import { UnarchiveStartEvent } from "./decompress-internal.js";
|
||||||
|
import { UnzipperInternal } from "./decompress-internal.js";
|
||||||
|
import { UnrarrerInternal } from "./decompress-internal.js";
|
||||||
|
import { UntarrerInternal } from "./decompress-internal.js";
|
||||||
|
export { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEventType, UnarchiveExtractEvent, UnarchiveFinishEvent, UnarchiveInfoEvent, UnarchiveProgressEvent, UnarchiveStartEvent, Unarchiver };
|
||||||
|
//# sourceMappingURL=decompress.d.ts.map
|
1
types/archive/decompress.d.ts.map
Normal file
1
types/archive/decompress.d.ts.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"decompress.d.ts","sourceRoot":"","sources":["../../archive/decompress.js"],"names":[],"mappings":"AAuEA;;;;;;;;;EASE;AACF,kCAPU,WAAW,YAGX,MAAO,MAAM,GAEX,UAAU,CAIrB;AAxBD;IACE,mCAAgE;CACjE;AAED;IACE,mCAAgE;CACjE;AAED;IACE,mCAAgE;CACjE;;cAjCa,MAAM;cACN,UAAU"}
|
3
types/index.d.ts
vendored
3
types/index.d.ts
vendored
|
@ -1,11 +1,12 @@
|
||||||
export { findMimeType } from "./file/sniffer.js";
|
export { findMimeType } from "./file/sniffer.js";
|
||||||
|
export { BitBuffer } from "./io/bitbuffer.js";
|
||||||
export { BitStream } from "./io/bitstream.js";
|
export { BitStream } from "./io/bitstream.js";
|
||||||
export { ByteBuffer } from "./io/bytebuffer.js";
|
export { ByteBuffer } from "./io/bytebuffer.js";
|
||||||
export { ByteStream } from "./io/bytestream.js";
|
export { ByteStream } from "./io/bytestream.js";
|
||||||
export type ProbeStream = import('./codecs/codecs.js').ProbeStream;
|
export type ProbeStream = import('./codecs/codecs.js').ProbeStream;
|
||||||
export type ProbeFormat = import('./codecs/codecs.js').ProbeFormat;
|
export type ProbeFormat = import('./codecs/codecs.js').ProbeFormat;
|
||||||
export type ProbeInfo = import('./codecs/codecs.js').ProbeInfo;
|
export type ProbeInfo = import('./codecs/codecs.js').ProbeInfo;
|
||||||
export { UnarchiveEvent, UnarchiveEventType, UnarchiveInfoEvent, UnarchiveErrorEvent, UnarchiveStartEvent, UnarchiveFinishEvent, UnarchiveProgressEvent, UnarchiveExtractEvent, Unarchiver, Unzipper, Unrarrer, Untarrer, getUnarchiver } from "./archive/archive.js";
|
export { UnarchiveEvent, UnarchiveEventType, UnarchiveInfoEvent, UnarchiveErrorEvent, UnarchiveStartEvent, UnarchiveFinishEvent, UnarchiveProgressEvent, UnarchiveExtractEvent, Unarchiver, Unzipper, Unrarrer, Untarrer, getUnarchiver } from "./archive/decompress.js";
|
||||||
export { getFullMIMEString, getShortMIMEString } from "./codecs/codecs.js";
|
export { getFullMIMEString, getShortMIMEString } from "./codecs/codecs.js";
|
||||||
export { convertWebPtoPNG, convertWebPtoJPG } from "./image/webp-shim/webp-shim.js";
|
export { convertWebPtoPNG, convertWebPtoJPG } from "./image/webp-shim/webp-shim.js";
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";;;;0BASa,OAAO,oBAAoB,EAAE,WAAW;0BAGxC,OAAO,oBAAoB,EAAE,WAAW;wBAGxC,OAAO,oBAAoB,EAAE,SAAS"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";;;;;0BASa,OAAO,oBAAoB,EAAE,WAAW;0BAGxC,OAAO,oBAAoB,EAAE,WAAW;wBAGxC,OAAO,oBAAoB,EAAE,SAAS"}
|
55
types/io/bitbuffer.d.ts
vendored
Normal file
55
types/io/bitbuffer.d.ts
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
* A write-only Bit buffer which uses a Uint8Array as a backing store.
|
||||||
|
*/
|
||||||
|
export class BitBuffer {
|
||||||
|
/**
|
||||||
|
* @param {number} numBytes The number of bytes to allocate.
|
||||||
|
* @param {boolean} mtl The bit-packing mode. True means pack bits from most-significant (7) to
|
||||||
|
* least-significant (0). Defaults false: least-significant (0) to most-significant (8).
|
||||||
|
*/
|
||||||
|
constructor(numBytes: number, mtl?: boolean);
|
||||||
|
/**
|
||||||
|
* @type {Uint8Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
public data: Uint8Array;
|
||||||
|
/**
|
||||||
|
* Whether we pack bits from most-significant-bit to least. Defaults false (least-to-most
|
||||||
|
* significant bit packing).
|
||||||
|
* @type {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private mtl;
|
||||||
|
/**
|
||||||
|
* The current byte we are filling with bits.
|
||||||
|
* @type {number}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
public bytePtr: number;
|
||||||
|
/**
|
||||||
|
* Points at the bit within the current byte where the next bit will go. This number ranges
|
||||||
|
* from 0 to 7 and the direction of packing is indicated by the mtl property.
|
||||||
|
* @type {number}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
public bitPtr: number;
|
||||||
|
/** @returns {boolean} */
|
||||||
|
getPackingDirection(): boolean;
|
||||||
|
/**
|
||||||
|
* Sets the bit-packing direction. Default (false) is least-significant-bit (0) to
|
||||||
|
* most-significant (7). Changing the bit-packing direction when the bit pointer is in the
|
||||||
|
* middle of a byte will fill the rest of that byte with 0s using the current bit-packing
|
||||||
|
* direction and then set the bit pointer to the appropriate bit of the next byte. If there
|
||||||
|
* are no more bytes left in this buffer, it will throw an error.
|
||||||
|
*/
|
||||||
|
setPackingDirection(mtl?: boolean): void;
|
||||||
|
/**
|
||||||
|
* writeBits(3, 6) is the same as writeBits(0b000011, 6).
|
||||||
|
* Will throw an error (without writing) if this would over-flow the buffer.
|
||||||
|
* @param {number} val The bits to pack into the buffer. Negative values are not allowed.
|
||||||
|
* @param {number} numBits Must be positive, non-zero and less or equal to than 53, since
|
||||||
|
* JavaScript can only support 53-bit integers.
|
||||||
|
*/
|
||||||
|
writeBits(val: number, numBits: number): void;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=bitbuffer.d.ts.map
|
1
types/io/bitbuffer.d.ts.map
Normal file
1
types/io/bitbuffer.d.ts.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"bitbuffer.d.ts","sourceRoot":"","sources":["../../io/bitbuffer.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH;IACE;;;;OAIG;IACH,sBAJW,MAAM,QACN,OAAO,EAoCjB;IA5BC;;;OAGG;IACH,aAHU,UAAU,CAGgB;IAEpC;;;;;OAKG;IACH,YAAc;IAEd;;;;OAIG;IACH,gBAHU,MAAM,CAGA;IAEhB;;;;;OAKG;IACH,eAHU,MAAM,CAGc;IAGhC,yBAAyB;IACzB,uBADc,OAAO,CAGpB;IAED;;;;;;OAMG;IACH,yCAkBC;IAED;;;;;;OAMG;IACH,eAJW,MAAM,WACN,MAAM,QA4FhB;CACF"}
|
213
types/io/bitstream.d.ts
vendored
213
types/io/bitstream.d.ts
vendored
|
@ -1,90 +1,125 @@
|
||||||
export const BitStream: {
|
/**
|
||||||
new (ab: ArrayBuffer, mtl: boolean, opt_offset: number, opt_length: number): {
|
* This object allows you to peek and consume bits and bytes out of a stream.
|
||||||
/**
|
* Note that this stream is optimized, and thus, will *NOT* throw an error if
|
||||||
* The bytes in the stream.
|
* the end of the stream is reached. Only use this in scenarios where you
|
||||||
* @type {Uint8Array}
|
* already have all the bits you need.
|
||||||
* @private
|
*
|
||||||
*/
|
* Bit reading always proceeds from the first byte in the buffer, to the
|
||||||
bytes: Uint8Array;
|
* second byte, and so on. The MTL flag controls which bit is considered
|
||||||
/**
|
* first *inside* the byte.
|
||||||
* The byte in the stream that we are currently on.
|
*
|
||||||
* @type {Number}
|
* An Example for how Most-To-Least vs Least-to-Most mode works:
|
||||||
* @private
|
*
|
||||||
*/
|
* If you have an ArrayBuffer with the following two Uint8s:
|
||||||
bytePtr: number;
|
* 185 (0b10111001) and 66 (0b01000010)
|
||||||
/**
|
* and you perform a series of readBits: 2 bits, then 3, then 5, then 6.
|
||||||
* The bit in the current byte that we will read next (can have values 0 through 7).
|
*
|
||||||
* @type {Number}
|
* A BitStream in "mtl" mode will yield the following:
|
||||||
* @private
|
* - readBits(2) => 2 ('10')
|
||||||
*/
|
* - readBits(3) => 7 ('111')
|
||||||
bitPtr: number;
|
* - readBits(5) => 5 ('00101')
|
||||||
/**
|
* - readBits(6) => 2 ('000010')
|
||||||
* An ever-increasing number.
|
*
|
||||||
* @type {Number}
|
* A BitStream in "ltm" mode will yield the following:
|
||||||
* @private
|
* - readBits(2) => 1 ('01')
|
||||||
*/
|
* - readBits(3) => 6 ('110')
|
||||||
bitsRead_: number;
|
* - readBits(5) => 21 ('10101')
|
||||||
peekBits: (n: number, opt_movePointers: any) => number;
|
* - readBits(6) => 16 ('010000')
|
||||||
/**
|
*/
|
||||||
* Returns how many bites have been read in the stream since the beginning of time.
|
export class BitStream {
|
||||||
* @returns {number}
|
/**
|
||||||
*/
|
* @param {ArrayBuffer} ab An ArrayBuffer object or a Uint8Array.
|
||||||
getNumBitsRead(): number;
|
* @param {boolean} mtl Whether the stream reads bits from the byte starting with the
|
||||||
/**
|
* most-significant-bit (bit 7) to least-significant (bit 0). False means the direction is
|
||||||
* Returns how many bits are currently in the stream left to be read.
|
* from least-significant-bit (bit 0) to most-significant (bit 7).
|
||||||
* @returns {number}
|
* @param {Number} opt_offset The offset into the ArrayBuffer
|
||||||
*/
|
* @param {Number} opt_length The length of this BitStream
|
||||||
getNumBitsLeft(): number;
|
*/
|
||||||
/**
|
constructor(ab: ArrayBuffer, mtl: boolean, opt_offset: number, opt_length: number);
|
||||||
* byte0 byte1 byte2 byte3
|
/**
|
||||||
* 7......0 | 7......0 | 7......0 | 7......0
|
* The bytes in the stream.
|
||||||
*
|
* @type {Uint8Array}
|
||||||
* The bit pointer starts at least-significant bit (0) of byte0 and moves left until it reaches
|
* @private
|
||||||
* bit7 of byte0, then jumps to bit0 of byte1, etc.
|
*/
|
||||||
* @param {number} n The number of bits to peek, must be a positive integer.
|
private bytes;
|
||||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
/**
|
||||||
* @returns {number} The peeked bits, as an unsigned number.
|
* The byte in the stream that we are currently on.
|
||||||
*/
|
* @type {Number}
|
||||||
peekBits_ltm(n: number, opt_movePointers: any): number;
|
* @private
|
||||||
/**
|
*/
|
||||||
* byte0 byte1 byte2 byte3
|
private bytePtr;
|
||||||
* 7......0 | 7......0 | 7......0 | 7......0
|
/**
|
||||||
*
|
* The bit in the current byte that we will read next (can have values 0 through 7).
|
||||||
* The bit pointer starts at bit7 of byte0 and moves right until it reaches
|
* @type {Number}
|
||||||
* bit0 of byte0, then goes to bit7 of byte1, etc.
|
* @private
|
||||||
* @param {number} n The number of bits to peek. Must be a positive integer.
|
*/
|
||||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
private bitPtr;
|
||||||
* @returns {number} The peeked bits, as an unsigned number.
|
/**
|
||||||
*/
|
* An ever-increasing number.
|
||||||
peekBits_mtl(n: number, opt_movePointers: any): number;
|
* @type {Number}
|
||||||
/**
|
* @private
|
||||||
* Peek at 16 bits from current position in the buffer.
|
*/
|
||||||
* Bit at (bytePtr,bitPtr) has the highest position in returning data.
|
private bitsRead_;
|
||||||
* Taken from getbits.hpp in unrar.
|
peekBits: (n: number, opt_movePointers: any) => number;
|
||||||
* TODO: Move this out of BitStream and into unrar.
|
/**
|
||||||
* @returns {number}
|
* Returns how many bites have been read in the stream since the beginning of time.
|
||||||
*/
|
* @returns {number}
|
||||||
getBits(): number;
|
*/
|
||||||
/**
|
getNumBitsRead(): number;
|
||||||
* Reads n bits out of the stream, consuming them (moving the bit pointer).
|
/**
|
||||||
* @param {number} n The number of bits to read. Must be a positive integer.
|
* Returns how many bits are currently in the stream left to be read.
|
||||||
* @returns {number} The read bits, as an unsigned number.
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
readBits(n: number): number;
|
getNumBitsLeft(): number;
|
||||||
/**
|
/**
|
||||||
* This returns n bytes as a sub-array, advancing the pointer if movePointers
|
* byte0 byte1 byte2 byte3
|
||||||
* is true. Only use this for uncompressed blocks as this throws away remaining
|
* 7......0 | 7......0 | 7......0 | 7......0
|
||||||
* bits in the current byte.
|
*
|
||||||
* @param {number} n The number of bytes to peek. Must be a positive integer.
|
* The bit pointer starts at least-significant bit (0) of byte0 and moves left until it reaches
|
||||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
* bit7 of byte0, then jumps to bit0 of byte1, etc.
|
||||||
* @returns {Uint8Array} The subarray.
|
* @param {number} n The number of bits to peek, must be a positive integer.
|
||||||
*/
|
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||||
peekBytes(n: number, opt_movePointers: any): Uint8Array;
|
* @returns {number} The peeked bits, as an unsigned number.
|
||||||
/**
|
*/
|
||||||
* @param {number} n The number of bytes to read.
|
peekBits_ltm(n: number, opt_movePointers: any): number;
|
||||||
* @returns {Uint8Array} The subarray.
|
/**
|
||||||
*/
|
* byte0 byte1 byte2 byte3
|
||||||
readBytes(n: number): Uint8Array;
|
* 7......0 | 7......0 | 7......0 | 7......0
|
||||||
};
|
*
|
||||||
};
|
* The bit pointer starts at bit7 of byte0 and moves right until it reaches
|
||||||
|
* bit0 of byte0, then goes to bit7 of byte1, etc.
|
||||||
|
* @param {number} n The number of bits to peek. Must be a positive integer.
|
||||||
|
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||||
|
* @returns {number} The peeked bits, as an unsigned number.
|
||||||
|
*/
|
||||||
|
peekBits_mtl(n: number, opt_movePointers: any): number;
|
||||||
|
/**
|
||||||
|
* Peek at 16 bits from current position in the buffer.
|
||||||
|
* Bit at (bytePtr,bitPtr) has the highest position in returning data.
|
||||||
|
* Taken from getbits.hpp in unrar.
|
||||||
|
* TODO: Move this out of BitStream and into unrar.
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
getBits(): number;
|
||||||
|
/**
|
||||||
|
* Reads n bits out of the stream, consuming them (moving the bit pointer).
|
||||||
|
* @param {number} n The number of bits to read. Must be a positive integer.
|
||||||
|
* @returns {number} The read bits, as an unsigned number.
|
||||||
|
*/
|
||||||
|
readBits(n: number): number;
|
||||||
|
/**
|
||||||
|
* This returns n bytes as a sub-array, advancing the pointer if movePointers
|
||||||
|
* is true. Only use this for uncompressed blocks as this throws away remaining
|
||||||
|
* bits in the current byte.
|
||||||
|
* @param {number} n The number of bytes to peek. Must be a positive integer.
|
||||||
|
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||||
|
* @returns {Uint8Array} The subarray.
|
||||||
|
*/
|
||||||
|
peekBytes(n: number, opt_movePointers: any): Uint8Array;
|
||||||
|
/**
|
||||||
|
* @param {number} n The number of bytes to read.
|
||||||
|
* @returns {Uint8Array} The subarray.
|
||||||
|
*/
|
||||||
|
readBytes(n: number): Uint8Array;
|
||||||
|
}
|
||||||
//# sourceMappingURL=bitstream.d.ts.map
|
//# sourceMappingURL=bitstream.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"bitstream.d.ts","sourceRoot":"","sources":["../../io/bitstream.js"],"names":[],"mappings":"AACA;aA8Ce,WAAW,OACX,OAAO;QAchB;;;;WAIG;eAFO,UAAU;QAKpB;;;;WAIG;;QAGH;;;;WAIG;;QAGH;;;;WAIG;;sBAuFM,MAAM,4BAEJ,MAAM;QAnFnB;;;WAGG;0BADU,MAAM;QAMnB;;;WAGG;0BADU,MAAM;QAOnB;;;;;;;;;WASG;wBAHQ,MAAM,0BAEJ,MAAM;QAkDnB;;;;;;;;;WASG;wBAHQ,MAAM,0BAEJ,MAAM;QAgDnB;;;;;;WAMG;mBADU,MAAM;QAQnB;;;;WAIG;oBAFQ,MAAM,GACJ,MAAM;QAMnB;;;;;;;WAOG;qBAHQ,MAAM,0BAEJ,UAAU;QAmDvB;;;WAGG;qBAFQ,MAAM,GACJ,UAAU;;EAQtB"}
|
{"version":3,"file":"bitstream.d.ts","sourceRoot":"","sources":["../../io/bitstream.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IACE;;;;;;;OAOG;IACH,gBAPW,WAAW,OACX,OAAO,0CA2CjB;IA7BC;;;;OAIG;IACH,cAA+C;IAE/C;;;;OAIG;IACH,gBAAgB;IAEhB;;;;OAIG;IACH,eAAe;IAEf;;;;OAIG;IACH,kBAAkB;IAElB,cAoFS,MAAM,4BAEJ,MAAM,CAtF0C;IAG7D;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAKlB;IAED;;;;;;;;;OASG;IACH,gBAJW,MAAM,0BAEJ,MAAM,CAgDlB;IAED;;;;;;;;;OASG;IACH,gBAJW,MAAM,0BAEJ,MAAM,CA8ClB;IAED;;;;;;OAMG;IACH,WAFa,MAAM,CAMlB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,aAJW,MAAM,0BAEJ,UAAU,CAiDtB;IAED;;;OAGG;IACH,aAHW,MAAM,GACJ,UAAU,CAItB;CACF"}
|
85
types/io/bytebuffer.d.ts
vendored
85
types/io/bytebuffer.d.ts
vendored
|
@ -1,41 +1,46 @@
|
||||||
export const ByteBuffer: {
|
/**
|
||||||
new (numBytes: number): {
|
* A write-only Byte buffer which uses a Uint8 Typed Array as a backing store.
|
||||||
/**
|
*/
|
||||||
* @type {Uint8Array}
|
export class ByteBuffer {
|
||||||
* @public
|
/**
|
||||||
*/
|
* @param {number} numBytes The number of bytes to allocate.
|
||||||
data: Uint8Array;
|
*/
|
||||||
/**
|
constructor(numBytes: number);
|
||||||
* @type {number}
|
/**
|
||||||
* @public
|
* @type {Uint8Array}
|
||||||
*/
|
* @public
|
||||||
ptr: number;
|
*/
|
||||||
/**
|
public data: Uint8Array;
|
||||||
* @param {number} b The byte to insert.
|
/**
|
||||||
*/
|
* @type {number}
|
||||||
insertByte(b: number): void;
|
* @public
|
||||||
/**
|
*/
|
||||||
* @param {Array.<number>|Uint8Array|Int8Array} bytes The bytes to insert.
|
public ptr: number;
|
||||||
*/
|
/**
|
||||||
insertBytes(bytes: Array<number> | Uint8Array | Int8Array): void;
|
* @param {number} b The byte to insert.
|
||||||
/**
|
*/
|
||||||
* Writes an unsigned number into the next n bytes. If the number is too large
|
insertByte(b: number): void;
|
||||||
* to fit into n bytes or is negative, an error is thrown.
|
/**
|
||||||
* @param {number} num The unsigned number to write.
|
* @param {Array.<number>|Uint8Array|Int8Array} bytes The bytes to insert.
|
||||||
* @param {number} numBytes The number of bytes to write the number into.
|
*/
|
||||||
*/
|
insertBytes(bytes: Array<number> | Uint8Array | Int8Array): void;
|
||||||
writeNumber(num: number, numBytes: number): void;
|
/**
|
||||||
/**
|
* Writes an unsigned number into the next n bytes. If the number is too large
|
||||||
* Writes a signed number into the next n bytes. If the number is too large
|
* to fit into n bytes or is negative, an error is thrown.
|
||||||
* to fit into n bytes, an error is thrown.
|
* @param {number} num The unsigned number to write.
|
||||||
* @param {number} num The signed number to write.
|
* @param {number} numBytes The number of bytes to write the number into.
|
||||||
* @param {number} numBytes The number of bytes to write the number into.
|
*/
|
||||||
*/
|
writeNumber(num: number, numBytes: number): void;
|
||||||
writeSignedNumber(num: number, numBytes: number): void;
|
/**
|
||||||
/**
|
* Writes a signed number into the next n bytes. If the number is too large
|
||||||
* @param {string} str The ASCII string to write.
|
* to fit into n bytes, an error is thrown.
|
||||||
*/
|
* @param {number} num The signed number to write.
|
||||||
writeASCIIString(str: string): void;
|
* @param {number} numBytes The number of bytes to write the number into.
|
||||||
};
|
*/
|
||||||
};
|
writeSignedNumber(num: number, numBytes: number): void;
|
||||||
|
/**
|
||||||
|
* @param {string} str The ASCII string to write.
|
||||||
|
*/
|
||||||
|
writeASCIIString(str: string): void;
|
||||||
|
}
|
||||||
//# sourceMappingURL=bytebuffer.d.ts.map
|
//# sourceMappingURL=bytebuffer.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"bytebuffer.d.ts","sourceRoot":"","sources":["../../io/bytebuffer.js"],"names":[],"mappings":"AACA;mBAkBe,MAAM;QAOf;;;WAGG;cAFO,UAAU;QAKpB;;;WAGG;aAFO,MAAM;QAOlB;;WAEG;sBADQ,MAAM;QAOjB;;WAEG;2BADQ,MAAO,MAAM,CAAC,GAAC,UAAU,GAAC,SAAS;QAQ9C;;;;;WAKG;yBAFQ,MAAM,YACN,MAAM;QAyBjB;;;;;WAKG;+BAFQ,MAAM,YACN,MAAM;QAuBjB;;WAEG;8BADQ,MAAM;;EAchB"}
|
{"version":3,"file":"bytebuffer.d.ts","sourceRoot":"","sources":["../../io/bytebuffer.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;OAEG;IACH,sBAFW,MAAM,EAkBhB;IAXC;;;OAGG;IACH,aAHU,UAAU,CAGgB;IAEpC;;;OAGG;IACH,YAHU,MAAM,CAGJ;IAId;;OAEG;IACH,cAFW,MAAM,QAKhB;IAED;;OAEG;IACH,mBAFW,MAAO,MAAM,CAAC,GAAC,UAAU,GAAC,SAAS,QAM7C;IAED;;;;;OAKG;IACH,iBAHW,MAAM,YACN,MAAM,QAuBhB;IAED;;;;;OAKG;IACH,uBAHW,MAAM,YACN,MAAM,QAqBhB;IAED;;OAEG;IACH,sBAFW,MAAM,QAUhB;CACF"}
|
225
types/io/bytestream.d.ts
vendored
225
types/io/bytestream.d.ts
vendored
|
@ -1,109 +1,118 @@
|
||||||
export const ByteStream: {
|
/**
|
||||||
new (ab: ArrayBuffer, opt_offset?: number | undefined, opt_length?: number | undefined): {
|
* This object allows you to peek and consume bytes as numbers and strings out
|
||||||
/**
|
* of a stream. More bytes can be pushed into the back of the stream via the
|
||||||
* The current page of bytes in the stream.
|
* push() method.
|
||||||
* @type {Uint8Array}
|
*/
|
||||||
* @private
|
export class ByteStream {
|
||||||
*/
|
/**
|
||||||
bytes: Uint8Array;
|
* @param {ArrayBuffer} ab The ArrayBuffer object.
|
||||||
/**
|
* @param {number=} opt_offset The offset into the ArrayBuffer
|
||||||
* The next pages of bytes in the stream.
|
* @param {number=} opt_length The length of this ByteStream
|
||||||
* @type {Array<Uint8Array>}
|
*/
|
||||||
* @private
|
constructor(ab: ArrayBuffer, opt_offset?: number | undefined, opt_length?: number | undefined);
|
||||||
*/
|
/**
|
||||||
pages_: Array<Uint8Array>;
|
* The current page of bytes in the stream.
|
||||||
/**
|
* @type {Uint8Array}
|
||||||
* The byte in the current page that we will read next.
|
* @private
|
||||||
* @type {Number}
|
*/
|
||||||
* @private
|
private bytes;
|
||||||
*/
|
/**
|
||||||
ptr: number;
|
* The next pages of bytes in the stream.
|
||||||
/**
|
* @type {Array<Uint8Array>}
|
||||||
* An ever-increasing number.
|
* @private
|
||||||
* @type {Number}
|
*/
|
||||||
* @private
|
private pages_;
|
||||||
*/
|
/**
|
||||||
bytesRead_: number;
|
* The byte in the current page that we will read next.
|
||||||
/**
|
* @type {Number}
|
||||||
* Returns how many bytes have been read in the stream since the beginning of time.
|
* @private
|
||||||
*/
|
*/
|
||||||
getNumBytesRead(): number;
|
private ptr;
|
||||||
/**
|
/**
|
||||||
* Returns how many bytes are currently in the stream left to be read.
|
* An ever-increasing number.
|
||||||
*/
|
* @type {Number}
|
||||||
getNumBytesLeft(): number;
|
* @private
|
||||||
/**
|
*/
|
||||||
* Move the pointer ahead n bytes. If the pointer is at the end of the current array
|
private bytesRead_;
|
||||||
* of bytes and we have another page of bytes, point at the new page. This is a private
|
/**
|
||||||
* method, no validation is done.
|
* Returns how many bytes have been read in the stream since the beginning of time.
|
||||||
* @param {number} n Number of bytes to increment.
|
*/
|
||||||
* @private
|
getNumBytesRead(): number;
|
||||||
*/
|
/**
|
||||||
movePointer_(n: number): void;
|
* Returns how many bytes are currently in the stream left to be read.
|
||||||
/**
|
*/
|
||||||
* Peeks at the next n bytes as an unsigned number but does not advance the
|
getNumBytesLeft(): number;
|
||||||
* pointer.
|
/**
|
||||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
* Move the pointer ahead n bytes. If the pointer is at the end of the current array
|
||||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
* of bytes and we have another page of bytes, point at the new page. This is a private
|
||||||
*/
|
* method, no validation is done.
|
||||||
peekNumber(n: number): number;
|
* @param {number} n Number of bytes to increment.
|
||||||
/**
|
* @private
|
||||||
* Returns the next n bytes as an unsigned number (or -1 on error)
|
*/
|
||||||
* and advances the stream pointer n bytes.
|
private movePointer_;
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
/**
|
||||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
* Peeks at the next n bytes as an unsigned number but does not advance the
|
||||||
*/
|
* pointer.
|
||||||
readNumber(n: number): number;
|
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||||
/**
|
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||||
* Returns the next n bytes as a signed number but does not advance the
|
*/
|
||||||
* pointer.
|
peekNumber(n: number): number;
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
/**
|
||||||
* @returns {number} The bytes interpreted as a signed number.
|
* Returns the next n bytes as an unsigned number (or -1 on error)
|
||||||
*/
|
* and advances the stream pointer n bytes.
|
||||||
peekSignedNumber(n: number): number;
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
/**
|
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||||
* Returns the next n bytes as a signed number and advances the stream pointer.
|
*/
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
readNumber(n: number): number;
|
||||||
* @returns {number} The bytes interpreted as a signed number.
|
/**
|
||||||
*/
|
* Returns the next n bytes as a signed number but does not advance the
|
||||||
readSignedNumber(n: number): number;
|
* pointer.
|
||||||
/**
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
* This returns n bytes as a sub-array, advancing the pointer if movePointers
|
* @returns {number} The bytes interpreted as a signed number.
|
||||||
* is true.
|
*/
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
peekSignedNumber(n: number): number;
|
||||||
* @param {boolean} movePointers Whether to move the pointers.
|
/**
|
||||||
* @returns {Uint8Array} The subarray.
|
* Returns the next n bytes as a signed number and advances the stream pointer.
|
||||||
*/
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
peekBytes(n: number, movePointers: boolean): Uint8Array;
|
* @returns {number} The bytes interpreted as a signed number.
|
||||||
/**
|
*/
|
||||||
* Reads the next n bytes as a sub-array.
|
readSignedNumber(n: number): number;
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
/**
|
||||||
* @returns {Uint8Array} The subarray.
|
* This returns n bytes as a sub-array, advancing the pointer if movePointers
|
||||||
*/
|
* is true.
|
||||||
readBytes(n: number): Uint8Array;
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
/**
|
* @param {boolean} movePointers Whether to move the pointers.
|
||||||
* Peeks at the next n bytes as an ASCII string but does not advance the pointer.
|
* @returns {Uint8Array} The subarray.
|
||||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
*/
|
||||||
* @returns {string} The next n bytes as a string.
|
peekBytes(n: number, movePointers: boolean): Uint8Array;
|
||||||
*/
|
/**
|
||||||
peekString(n: number): string;
|
* Reads the next n bytes as a sub-array.
|
||||||
/**
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
* Returns the next n bytes as an ASCII string and advances the stream pointer
|
* @returns {Uint8Array} The subarray.
|
||||||
* n bytes.
|
*/
|
||||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
readBytes(n: number): Uint8Array;
|
||||||
* @returns {string} The next n bytes as a string.
|
/**
|
||||||
*/
|
* Peeks at the next n bytes as an ASCII string but does not advance the pointer.
|
||||||
readString(n: number): string;
|
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||||
/**
|
* @returns {string} The next n bytes as a string.
|
||||||
* Feeds more bytes into the back of the stream.
|
*/
|
||||||
* @param {ArrayBuffer} ab
|
peekString(n: number): string;
|
||||||
*/
|
/**
|
||||||
push(ab: ArrayBuffer): void;
|
* Returns the next n bytes as an ASCII string and advances the stream pointer
|
||||||
/**
|
* n bytes.
|
||||||
* Creates a new ByteStream from this ByteStream that can be read / peeked.
|
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||||
* @returns {ByteStream} A clone of this ByteStream.
|
* @returns {string} The next n bytes as a string.
|
||||||
*/
|
*/
|
||||||
tee(): any;
|
readString(n: number): string;
|
||||||
};
|
/**
|
||||||
};
|
* Feeds more bytes into the back of the stream.
|
||||||
|
* @param {ArrayBuffer} ab
|
||||||
|
*/
|
||||||
|
push(ab: ArrayBuffer): void;
|
||||||
|
/**
|
||||||
|
* Creates a new ByteStream from this ByteStream that can be read / peeked.
|
||||||
|
* @returns {ByteStream} A clone of this ByteStream.
|
||||||
|
*/
|
||||||
|
tee(): ByteStream;
|
||||||
|
}
|
||||||
//# sourceMappingURL=bytestream.d.ts.map
|
//# sourceMappingURL=bytestream.d.ts.map
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"bytestream.d.ts","sourceRoot":"","sources":["../../io/bytestream.js"],"names":[],"mappings":"AACA;aAoBe,WAAW,eACX,MAAM,2BACN,MAAM;QAUf;;;;WAIG;eAFO,UAAU;QAKpB;;;;WAIG;gBAFO,MAAM,UAAU,CAAC;QAK3B;;;;WAIG;;QAGH;;;;WAIG;;QAIL;;WAEG;;QAKH;;WAEG;;QAMH;;;;;;WAMG;wBAFQ,MAAM;QAYjB;;;;;WAKG;sBAFQ,MAAM,GACJ,MAAM;QAqCnB;;;;;WAKG;sBAFQ,MAAM,GACJ,MAAM;QASnB;;;;;WAKG;4BAFQ,MAAM,GACJ,MAAM;QAanB;;;;WAIG;4BAFQ,MAAM,GACJ,MAAM;QASnB;;;;;;WAMG;qBAHQ,MAAM,gBACN,OAAO,GACL,UAAU;QA2CvB;;;;WAIG;qBAFQ,MAAM,GACJ,UAAU;QAMvB;;;;WAIG;sBAFQ,MAAM,GACJ,MAAM;QA+BnB;;;;;WAKG;sBAFQ,MAAM,GACJ,MAAM;QAQnB;;;WAGG;iBADQ,WAAW;QAatB;;;WAGG;;;EAYF"}
|
{"version":3,"file":"bytestream.d.ts","sourceRoot":"","sources":["../../io/bytestream.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACE;;;;OAIG;IACH,gBAJW,WAAW,eACX,MAAM,2BACN,MAAM,cAqChB;IA3BC;;;;OAIG;IACH,cAA+C;IAE/C;;;;OAIG;IACH,eAAgB;IAEhB;;;;OAIG;IACH,YAAY;IAEZ;;;;OAIG;IACH,mBAAmB;IAGrB;;OAEG;IACH,0BAEC;IAED;;OAEG;IACH,0BAGC;IAED;;;;;;OAMG;IACH,qBAOC;IAED;;;;;OAKG;IACH,cAHW,MAAM,GACJ,MAAM,CAkClB;IAGD;;;;;OAKG;IACH,cAHW,MAAM,GACJ,MAAM,CAMlB;IAGD;;;;;OAKG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAGD;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAMlB;IAGD;;;;;;OAMG;IACH,aAJW,MAAM,gBACN,OAAO,GACL,UAAU,CAyCtB;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,UAAU,CAItB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,MAAM,CA6BlB;IAED;;;;;OAKG;IACH,cAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;OAGG;IACH,SAFW,WAAW,QAWrB;IAED;;;OAGG;IACH,OAFa,UAAU,CAStB;CACF"}
|
Loading…
Add table
Add a link
Reference in a new issue