UNPKG

1.79 kBTypeScriptView Raw
1// Type definitions for move-concurrently 1.0
2// Project: https://www.npmjs.com/package/move-concurrently
3// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.2
6
7/**
8 * 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.
9 */
10declare function move<T extends PromiseLike<void> = Promise<void>>(from: string, to: string, opts?: move.Options<T>): T;
11
12declare namespace move {
13 interface Options<T extends PromiseLike<void> = Promise<void>> {
14 /**
15 * (Default: 1) The maximum number of concurrent copies to do at once.
16 */
17 maxConcurrency?: number;
18 /**
19 * (Default: process.platform === 'win32') If true enables Windows symlink semantics.
20 * This requires an extra stat to determine if the destination of a symlink is a file or directory.
21 * If symlinking a directory fails then we'll try making a junction instead.
22 */
23 isWindows?: boolean;
24 /**
25 * (Default: global.Promise) The promise implementation to use, defaults to Node's.
26 */
27 Promise?: new (...args: any[]) => T;
28 /**
29 * (Default: require('fs')) The filesystem module to use. Can be used to use graceful-fs or to inject a mock.
30 */
31 fs?: any;
32 /**
33 * (Default: require('fs-write-stream-atomic')) The implementation of writeStreamAtomic to use. Used to inject a mock.
34 */
35 writeStreamAtomic?: any;
36 /**
37 * (Default: process.getuid) A function that returns the current UID. Used to inject a mock.
38 */
39 getuid?: any;
40 }
41}
42
43export = move;