UNPKG

1.74 kBTypeScriptView Raw
1// Type definitions for cpx 1.5
2// Project: https://github.com/mysticatea/cpx
3// Definitions by: Alan Agius <https://github.com/alan-agius4>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/// <reference types="node" />
7
8import * as stream from "stream";
9import { EventEmitter } from 'events';
10
11export interface SyncOptions {
12 /** remove files that copied on past before copy. */
13 clean?: boolean | undefined;
14 /** Follow symbolic links when copying from them. */
15 dereference?: boolean | undefined;
16 /** Copy empty directories which is matched with the glob. */
17 includeEmptyDirs?: boolean | undefined;
18 /** Preserve UID, GID, ATIME, and MTIME of files. */
19 preserve?: boolean | undefined;
20 /** Do not overwrite files on destination if the source file is older. */
21 update?: boolean | undefined;
22}
23
24export interface AsyncOptions extends SyncOptions {
25 /** Function that creates a `stream.Transform` object to transform each copying file. */
26 transform?(filepath: string): stream.Transform[];
27}
28
29export interface WatchOptions extends AsyncOptions, SyncOptions {
30 /** Flag to not copy at the initial time of watch. */
31 initialCopy?: boolean | undefined;
32}
33
34export class Watcher extends EventEmitter {
35 constructor(options: WatchOptions);
36 open(): void;
37 close(): void;
38}
39
40export function copy(source: string, dest: string, options?: AsyncOptions, callback?: (error: Error | null) => void): void;
41export function copy(source: string, dest: string, callback?: (error: Error | null) => void): void;
42
43export function copySync(source: string, dest: string, options?: SyncOptions): void;
44
45export function watch(source: string, dest: string, options?: WatchOptions): Watcher;