1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Correct some typos, expose codecs in the main module (woops), and provide Typescript types (d.ts files)

This commit is contained in:
Jeff Schiller 2022-10-30 16:54:53 -07:00
parent 28e8a8e449
commit d5971c0fdb
23 changed files with 701 additions and 5 deletions

41
types/io/bytebuffer.d.ts vendored Normal file
View file

@ -0,0 +1,41 @@
export const ByteBuffer: {
new (numBytes: number): {
/**
* @type {Uint8Array}
* @public
*/
data: Uint8Array;
/**
* @type {number}
* @public
*/
ptr: number;
/**
* @param {number} b The byte to insert.
*/
insertByte(b: number): void;
/**
* @param {Array.<number>|Uint8Array|Int8Array} bytes The bytes to insert.
*/
insertBytes(bytes: Array<number> | Uint8Array | Int8Array): void;
/**
* Writes an unsigned number into the next n bytes. If the number is too large
* to fit into n bytes or is negative, an error is thrown.
* @param {number} num The unsigned number to write.
* @param {number} numBytes The number of bytes to write the number into.
*/
writeNumber(num: number, numBytes: number): void;
/**
* Writes a signed number into the next n bytes. If the number is too large
* to fit into n bytes, an error is thrown.
* @param {number} num The signed number to write.
* @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