-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.d.ts
44 lines (34 loc) · 1.21 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Type definitions for biguint-format
// Project: biguint-format https://github.com/T-PWK/flake-idgen
// Definitions by: m-star https://github.com/mstar-kk
/// <reference types="node" />
interface FORMATS {
dec: typeof toDecimalString;
hex: typeof toHexString;
bin: typeof toBinaryString;
oct: typeof toOctetString;
}
interface formatOption {
format?: string;
groupsize?: number;
delimiter?: string;
padstr?: string;
size?: number;
trim?: boolean;
prefix?: string;
}
export default function (
buffer: Buffer,
base: 'dec' | 'hex' | 'bin' | 'oct',
options?: formatOption
): string;
export function createBuffer(size: number): Buffer;
export function createBufferFrom(object: object): Buffer;
export function toDecimalString(buffer: Buffer, options?: formatOption): string;
export function toBinaryString(buffer: Buffer, options?: formatOption): string;
/*
* Converts given input (node Buffer or array of bytes) to hexadecimal string 0xDDDD where D is [0-9a-f].
* All leading 0's are stripped out i.e. [0x00, 0x00, 0x00, 0x01] -> '0x1'
*/
export function toHexString(buffer: Buffer, options?: formatOption): string;
export function toOctetString(buffer: Buffer, options?: formatOption): string;