UNPKG

ts-utls

Version:

Utilities for TypeScript library

32 lines 1.28 kB
/** * Convert a byte array to its string representation of byte(s) * * @param {Buffer} buf - The buffer to transform * @returns the string representation of the octet(s), ie. one or more sequences of eight 0s or 1s */ export declare const buffer2BytesString: (buf: Buffer) => string; /** * Get the byte array from an unsigned integer * * @param {number} uint - The unsigned integer to transform * @returns the `Buffer` * @throws invalid signed integer */ export declare const int2Buffer: (uint: number) => Buffer; /** * * @param {Buffer} buf - The buffer to split * @param {Buffer} delimiter - The buffer to use to cut * @param {boolean} returnDelim - Set to `true` should the delimiter be included in the returned array (Default: `false`) * @returns an array of byte arrays */ export declare const splitBuffer: (buf: Buffer, delimiter: Buffer, returnDelim?: boolean) => Array<Buffer>; /** * Transform the string representation of byte(s) to a byte array * * @param {string} bits - The string representation of the octet(s) to transform, ie. one or more sequences of eight 0s or 1s * @returns the `Buffer` * @throws not the string representation of bytes */ export declare const stringBytes2Buffer: (bits: string) => Buffer; //# sourceMappingURL=buffer.d.ts.map