-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.d.ts
31 lines (24 loc) · 1.61 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
type RetType = 'hex' | 'array' | 'int' | 'buffer';
type CheckSumOption = {
retType?: RetType
} & {
(key?: string): any
};
// export function checkSum(input: string, encoding?: string | CheckSumOption, option?: CheckSumOption): string | number | [] | Buffer;
export function checkSum(input: string, option: {retType: 'hex'}): string;
export function checkSum(input: string, option: {retType: 'array'}): [];
export function checkSum(input: string, option: {retType: 'int'}): number;
export function checkSum(input: string, option: {retType: 'buffer'}): Buffer;
export function checkSum(input: string, option?: {retType: any}): string;
export function checkSum(input: string, encoding: BufferEncoding, option: {retType: 'hex'}): string;
export function checkSum(input: string, encoding: BufferEncoding, option: {retType: 'array'}): [];
export function checkSum(input: string, encoding: BufferEncoding, option: {retType: 'int'}): number;
export function checkSum(input: string, encoding: BufferEncoding, option: {retType: 'buffer'}): Buffer;
export function checkSum(input: string, encoding: BufferEncoding, option?: {retType: any}): string;
export function checkSum(input: Buffer, option: {retType: 'hex'}): string;
export function checkSum(input: Buffer, option: {retType: 'array'}): [];
export function checkSum(input: Buffer, option: {retType: 'int'}): number;
export function checkSum(input: Buffer, option: {retType: 'buffer'}): Buffer;
export function checkSum(input: Buffer, option?: {retType: any}): string;
export function verifySum(input: string, encoding?: string): boolean;
export function verifySum(input: Buffer): boolean;