-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
52 lines (48 loc) · 2.06 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
45
46
47
48
49
50
51
52
/**
* Options supported by tree-sync. This is current a whitelist of options supported by walk-sync
* and is passed verbatim as provided.
*/
export type TreeSyncOptions = {
/**
* An array of globs. Only files and directories that match at least one of the provided globs
* will be returned.
* If using this option, it's important to ensure that you've included parent directories of files
* you add, otherwise you might run into an ENOENT error!
*/
globs?: string[],
/**
* An array of globs. Files and directories that match at least one of the provided globs will be
* pruned while searching.
*/
ignore?: string[],
}
/**
* A result from a patch operation.
* The first item in the tuple is the operation that was run - can be one of "create", "change", "mkdir",
* "unlink", or "rmdir".
* The second item is the path that was affected, relative to the root input/output directory.
*/
export type TreeSyncResult = [string, string];
/**
* A module for repeated efficient synchronizing two directories.
* Use the `sync()` method to run a sync from the input path to the output path.
* @see https://github.com/stefanpenner/tree-sync
*/
export default class TreeSync {
/**
* Initializes a new TreeSync instance. This instance is used to keep an output directory in sync with its
* input directory. When using the same instance to keep two directories in sync over multiple sync operations,
* TreeSync will figure out the differences between the two folders and only sync those changes specifically,
* which in many cases will improve performance.
*
* @param inputPath The originating path to sync contents from.
* @param outputPath The resulting path to sync contents to.
* @param treeSyncOpts Options on how to run tree-sync. Use this to selectively choose or ignore directories
* to sync.
*/
constructor(inputPath: string, outputPath: string, treeSyncOpts?: TreeSyncOptions);
/**
* Syncs the input directory to the output directory. File I/O is done synchronously.
*/
sync(): TreeSyncResult[];
}