-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.d.ts
More file actions
128 lines (118 loc) · 3.24 KB
/
Copy pathindex.d.ts
File metadata and controls
128 lines (118 loc) · 3.24 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/// <reference types="node" />
export type BinaryLike = Buffer | ArrayBufferView;
export type DiffCallback = (err: Error | null, result?: Buffer) => void;
export type StreamCallback = (err: Error | null, outPath?: string) => void;
export type HpatchCover = {
oldPos: number | string | bigint;
newPos: number | string | bigint;
len: number | string | bigint;
};
export type DiffWithCoversResult = {
diff: Buffer;
usedCovers: boolean;
requestedCoverCount: number;
nativeCoverCapacity: number;
finalCoverCount: number;
coverMode: 'replace' | 'merge' | 'native-coalesce';
nativeCovers?: HpatchCover[];
finalCovers?: HpatchCover[];
};
export type DiffWithCoversOptions = {
mode?: 'replace' | 'merge' | 'native-coalesce' | 'native_coalesce';
debugCovers?: boolean;
};
export interface NativeAddon {
diff(oldBuf: BinaryLike, newBuf: BinaryLike): Buffer;
diff(oldBuf: BinaryLike, newBuf: BinaryLike, cb: DiffCallback): void;
diffWithCovers(
oldBuf: BinaryLike,
newBuf: BinaryLike,
covers: HpatchCover[],
options?: DiffWithCoversOptions
): DiffWithCoversResult;
patch(oldBuf: BinaryLike, diffBuf: BinaryLike): Buffer;
patch(oldBuf: BinaryLike, diffBuf: BinaryLike, cb: DiffCallback): void;
diffStream(oldPath: string, newPath: string, outDiffPath: string): string;
diffStream(
oldPath: string,
newPath: string,
outDiffPath: string,
cb: StreamCallback
): void;
patchStream(oldPath: string, diffPath: string, outNewPath: string): string;
patchStream(
oldPath: string,
diffPath: string,
outNewPath: string,
cb: StreamCallback
): void;
patchSingleStream(oldPath: string, diffPath: string, outNewPath: string): string;
patchSingleStream(
oldPath: string,
diffPath: string,
outNewPath: string,
cb: StreamCallback
): void;
}
export const native: NativeAddon;
export function diff(oldBuf: BinaryLike, newBuf: BinaryLike): Buffer;
export function diff(
oldBuf: BinaryLike,
newBuf: BinaryLike,
cb: DiffCallback
): void;
export function diffWithCovers(
oldBuf: BinaryLike,
newBuf: BinaryLike,
covers: HpatchCover[],
options?: DiffWithCoversOptions
): DiffWithCoversResult;
export function patch(oldBuf: BinaryLike, diffBuf: BinaryLike): Buffer;
export function patch(
oldBuf: BinaryLike,
diffBuf: BinaryLike,
cb: DiffCallback
): void;
export function diffStream(
oldPath: string,
newPath: string,
outDiffPath: string
): string;
export function diffStream(
oldPath: string,
newPath: string,
outDiffPath: string,
cb: StreamCallback
): void;
export function patchStream(
oldPath: string,
diffPath: string,
outNewPath: string
): string;
export function patchStream(
oldPath: string,
diffPath: string,
outNewPath: string,
cb: StreamCallback
): void;
export function patchSingleStream(
oldPath: string,
diffPath: string,
outNewPath: string
): string;
export function patchSingleStream(
oldPath: string,
diffPath: string,
outNewPath: string,
cb: StreamCallback
): void;
declare const hdiffpatch: {
native: NativeAddon;
diff: typeof diff;
diffWithCovers: typeof diffWithCovers;
patch: typeof patch;
diffStream: typeof diffStream;
patchStream: typeof patchStream;
patchSingleStream: typeof patchSingleStream;
};
export default hdiffpatch;