-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.d.ts
More file actions
159 lines (148 loc) · 3.89 KB
/
Copy pathindex.d.ts
File metadata and controls
159 lines (148 loc) · 3.89 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/// <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 interface NativeAddon {
diff(oldBuf: BinaryLike, newBuf: BinaryLike): Buffer;
diff(oldBuf: BinaryLike, newBuf: BinaryLike, cb: DiffCallback): void;
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;
diffSingleStream(oldPath: string, newPath: string, outDiffPath: string): string;
diffSingleStream(
oldPath: string,
newPath: string,
outDiffPath: string,
cb: StreamCallback,
): void;
patchSingleStream(oldPath: string, diffPath: string, outNewPath: string): string;
patchSingleStream(
oldPath: string,
diffPath: string,
outNewPath: string,
cb: StreamCallback
): void;
diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
windowSize?: number
): string;
diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
cb: StreamCallback
): void;
diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
windowSize: number,
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 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 diffSingleStream(
oldPath: string,
newPath: string,
outDiffPath: string,
): string;
export function diffSingleStream(
oldPath: string,
newPath: string,
outDiffPath: 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;
// window 模式生成 HDIFFSF20 single 格式 patch:匹配质量接近内存版
// diff(),内存占用保持流式档;产物用 patch()/patchSingleStream() 应用。
// windowSize 为 old 数据滑动窗口字节数(缺省 2MB),调大可捕获更长距离
// 的内容移动,内存占用近似线性增长。
export function diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
windowSize?: number
): string;
export function diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
cb: StreamCallback
): void;
export function diffWindow(
oldPath: string,
newPath: string,
outDiffPath: string,
windowSize: number,
cb: StreamCallback
): void;
declare const hdiffpatch: {
native: NativeAddon;
diff: typeof diff;
patch: typeof patch;
diffStream: typeof diffStream;
patchStream: typeof patchStream;
diffSingleStream: typeof diffSingleStream;
patchSingleStream: typeof patchSingleStream;
diffWindow: typeof diffWindow;
};
export default hdiffpatch;