|
| 1 | +/// <reference types="node" /> |
| 2 | + |
| 3 | +export type BinaryLike = Buffer | ArrayBufferView; |
| 4 | + |
| 5 | +export type DiffCallback = (err: Error | null, result?: Buffer) => void; |
| 6 | +export type StreamCallback = (err: Error | null, outPath?: string) => void; |
| 7 | + |
| 8 | +export interface NativeAddon { |
| 9 | + diff(oldBuf: BinaryLike, newBuf: BinaryLike): Buffer; |
| 10 | + diff(oldBuf: BinaryLike, newBuf: BinaryLike, cb: DiffCallback): void; |
| 11 | + patch(oldBuf: BinaryLike, diffBuf: BinaryLike): Buffer; |
| 12 | + patch(oldBuf: BinaryLike, diffBuf: BinaryLike, cb: DiffCallback): void; |
| 13 | + diffStream(oldPath: string, newPath: string, outDiffPath: string): string; |
| 14 | + diffStream( |
| 15 | + oldPath: string, |
| 16 | + newPath: string, |
| 17 | + outDiffPath: string, |
| 18 | + cb: StreamCallback |
| 19 | + ): void; |
| 20 | + patchStream(oldPath: string, diffPath: string, outNewPath: string): string; |
| 21 | + patchStream( |
| 22 | + oldPath: string, |
| 23 | + diffPath: string, |
| 24 | + outNewPath: string, |
| 25 | + cb: StreamCallback |
| 26 | + ): void; |
| 27 | +} |
| 28 | + |
| 29 | +export const native: NativeAddon; |
| 30 | + |
| 31 | +export function diff(oldBuf: BinaryLike, newBuf: BinaryLike): Buffer; |
| 32 | +export function diff( |
| 33 | + oldBuf: BinaryLike, |
| 34 | + newBuf: BinaryLike, |
| 35 | + cb: DiffCallback |
| 36 | +): void; |
| 37 | + |
| 38 | +export function patch(oldBuf: BinaryLike, diffBuf: BinaryLike): Buffer; |
| 39 | +export function patch( |
| 40 | + oldBuf: BinaryLike, |
| 41 | + diffBuf: BinaryLike, |
| 42 | + cb: DiffCallback |
| 43 | +): void; |
| 44 | + |
| 45 | +export function diffStream( |
| 46 | + oldPath: string, |
| 47 | + newPath: string, |
| 48 | + outDiffPath: string |
| 49 | +): string; |
| 50 | +export function diffStream( |
| 51 | + oldPath: string, |
| 52 | + newPath: string, |
| 53 | + outDiffPath: string, |
| 54 | + cb: StreamCallback |
| 55 | +): void; |
| 56 | + |
| 57 | +export function patchStream( |
| 58 | + oldPath: string, |
| 59 | + diffPath: string, |
| 60 | + outNewPath: string |
| 61 | +): string; |
| 62 | +export function patchStream( |
| 63 | + oldPath: string, |
| 64 | + diffPath: string, |
| 65 | + outNewPath: string, |
| 66 | + cb: StreamCallback |
| 67 | +): void; |
| 68 | + |
| 69 | +declare const hdiffpatch: { |
| 70 | + native: NativeAddon; |
| 71 | + diff: typeof diff; |
| 72 | + patch: typeof patch; |
| 73 | + diffStream: typeof diffStream; |
| 74 | + patchStream: typeof patchStream; |
| 75 | +}; |
| 76 | + |
| 77 | +export default hdiffpatch; |
0 commit comments