UNPKG

1.76 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as fs from "fs";
3
4declare namespace ncp {
5 interface File {
6 name: string;
7 mode: number;
8
9 /** Accessed time */
10 atime: Date;
11
12 /** Modified time */
13 mtime: Date;
14 }
15
16 interface Options {
17 filter?: RegExp | ((filename: string) => boolean) | undefined;
18 transform?: ((read: NodeJS.ReadableStream, write: NodeJS.WritableStream, file: File) => void) | undefined;
19 clobber?: boolean | undefined;
20 dereference?: boolean | undefined;
21 stopOnErr?: boolean | undefined;
22 errs?: fs.PathLike | undefined;
23 limit?: number | undefined;
24 }
25}
26
27declare const ncp: {
28 (source: string, destination: string, callback: (err: Error[] | null) => void): void;
29 (
30 source: string,
31 destination: string,
32 options: ncp.Options & { stopOnErr: true },
33 callback: (err: Error | null) => void,
34 ): void;
35 (
36 source: string,
37 destination: string,
38 options: ncp.Options & { errs?: undefined },
39 callback: (err: Error[] | null) => void,
40 ): void;
41 (
42 source: string,
43 destination: string,
44 options: ncp.Options & { errs: fs.PathLike },
45 callback: (err: fs.WriteStream | null) => void,
46 ): void;
47 (
48 source: string,
49 destination: string,
50 options: ncp.Options,
51 callback: (err: Error | Error[] | fs.WriteStream | null) => void,
52 ): void;
53
54 ncp: typeof ncp;
55
56 /**
57 * **NOTE:** This function provides design-time support for util.promisify.
58 *
59 * It does not exist at runtime.
60 */
61 __promisify__(source: string, destination: string, options?: ncp.Options): Promise<void>;
62};
63
64export = ncp;
65
\No newline at end of file