UNPKG

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