/// /** * Get byte size of a number. * * @param {number} number Number * * @returns {number} Byte size */ export declare function getByteSize(number: number): number; /** * Convert ArrayBuffer to Buffer. * * @param {ArrayBuffer} ab ArrayBuffer * * @returns {Buffer} Converted Buffer */ export declare function toBuffer(ab: ArrayBuffer): Buffer; /** * Bitfield data. * * @typedef {Buffer | ArrayBuffer | TypedArray | number} BitfieldData */ export declare type BitfieldData = Buffer | ArrayBuffer | TypedArray | number; /** * Bitfield options. * * @typedef {Object} BitfieldOptions * @property {number} [grow] If you set an index that is out of bounds, the Bitfield will automatically grow to this value. */ export declare type BitfieldOptions = { /** * If you set an index that is out of bounds, the Bitfield will * automatically grow to this value. If you want the Bitfield * to infinitely grow, set this to Infinity. */ grow?: number; }; /** * Represents any or all typed arrays in Node. * * @typedef {Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array} TypedArray */ export declare type TypedArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array; /** * Represents a Bitfield. */ export declare class Bitfield { /** * Value of the grow option. * * @public * * @type {number} */ grow: number; /** * Underlying typed array. Changing this manually * may break the Bitfield or cause unexpected bugs. * * @public * * @type {TypedArray} */ array: TypedArray; /** * Create a Bitfield. * * @param {BitfieldData} data Can be a Node.js Buffer, ArrayBuffer, typed array, numeric array, or a number representing the amount of bytes in the Bitfield * @param {BitfieldOptions} opts Other options */ constructor(data?: BitfieldData, opts?: BitfieldOptions); /** * Check if a bit is set. * * @public * * @param {number} index Bit index * * @returns {boolean} True if the bit is set */ get(index: number): boolean; /** * Set a bit. * * @public * * @param {number} index Bit index * @param {boolean | number} value Bit value * * @returns {void} */ set(index: number, value?: boolean | number): void; /** * Reset all bits. * * @public * * @returns {void} */ clear(): void; /** * Convert Bitfield into a Buffer. * * @public * * @returns {Buffer} Node.js Buffer */ toBuffer(): Buffer; /** * Convert Bitfield into a BigInt. * * @public * * @returns {BigInt} Node.js BigInt */ toBigInt(): BigInt; /** * Convert Bitfield into a hexadecimal string. * * @public * * @returns {string} Hexadecimal string */ toHex(): string; /** * Convert Bitfield into a UTF-8 encoded string. * * @public * * @returns {string} UTF-8 encoded string */ toString(): string; /** * Create a Bitfield from a Buffer or ArrayBuffer. * * @public * @static * * @param {Buffer | ArrayBuffer} buffer Buffer * @param {BitfieldOptions} opts Bitfield options * * @returns {Bitfield} Bitfield */ static fromBuffer(buffer: Buffer | ArrayBuffer, opts?: BitfieldOptions): Bitfield; /** * Create a Bitfield from a BigInt. * * @public * @static * * @param {bigint} bigint BigInt * @param {BitfieldOptions} opts Bitfield options * * @returns {Bitfield} Bitfield */ static fromBigInt(bigint: bigint, opts?: BitfieldOptions): Bitfield; /** * Create a Bitfield from a hexadecimal string. * * @public * @static * * @param {string} hex Hexadecimal string * @param {BitfieldOptions} opts Bitfield options * * @returns {Bitfield} Bitfield */ static fromHex(hex: string, opts?: BitfieldOptions): Bitfield; /** * Create a Bitfield from a UTF-8 encoded string. * * @public * @static * * @param {string} string UTF-8 encoded string. * @param {BitfieldOptions} opts Bitfield options * * @returns {Bitfield} Bitfield */ static fromString(string: string, opts?: BitfieldOptions): Bitfield; } //# sourceMappingURL=Bitfield.d.ts.map