UNPKG

1.57 kBTypeScriptView Raw
1/**
2 * Recursively moves from to to and resolves its promise when finished. If to already exists then the promise will be rejected with an EEXIST error.
3 */
4declare function move<T extends PromiseLike<void> = Promise<void>>(from: string, to: string, opts?: move.Options<T>): T;
5
6declare namespace move {
7 interface Options<T extends PromiseLike<void> = Promise<void>> {
8 /**
9 * (Default: 1) The maximum number of concurrent copies to do at once.
10 */
11 maxConcurrency?: number | undefined;
12 /**
13 * (Default: process.platform === 'win32') If true enables Windows symlink semantics.
14 * This requires an extra stat to determine if the destination of a symlink is a file or directory.
15 * If symlinking a directory fails then we'll try making a junction instead.
16 */
17 isWindows?: boolean | undefined;
18 /**
19 * (Default: global.Promise) The promise implementation to use, defaults to Node's.
20 */
21 Promise?: (new(...args: any[]) => T | undefined) | undefined;
22 /**
23 * (Default: require('fs')) The filesystem module to use. Can be used to use graceful-fs or to inject a mock.
24 */
25 fs?: any;
26 /**
27 * (Default: require('fs-write-stream-atomic')) The implementation of writeStreamAtomic to use. Used to inject a mock.
28 */
29 writeStreamAtomic?: any;
30 /**
31 * (Default: process.getuid) A function that returns the current UID. Used to inject a mock.
32 */
33 getuid?: any;
34 }
35}
36
37export = move;
38
\No newline at end of file