UNPKG

2.18 kBTypeScriptView Raw
1import * as Globby from 'globby';
2export declare type Filepath = string | string[];
3/**
4 * creates a directory if it does not exist
5 * this will automatically join the paths if you pass multiple strings with path.join()
6 */
7export declare function mkdirp(...filepaths: (string | string[])[]): Promise<void>;
8export declare namespace mkdirp {
9 function sync(...filepaths: (string | string[])[]): void;
10}
11/**
12 * glob matcher (find files)
13 */
14export declare function globby(patterns: string | string[], options?: Globby.GlobbyOptions): Promise<string[]>;
15/**
16 * output string to file
17 * creates directory if not exists
18 */
19export declare function write(filepaths: string | string[], data: any, options?: {}): Promise<void>;
20/**
21 * read file into string
22 */
23export declare function read(filepaths: string | string[], options?: {}): Promise<string>;
24/**
25 * list files in directory
26 */
27export declare function ls(filepaths?: string | string[], options?: {
28 fullpath?: boolean;
29}): Promise<string[]>;
30export declare function fileType(fp: string | string[]): Promise<'file' | 'directory' | 'symlink' | undefined>;
31/**
32 * copy files with fs.copy
33 * can copy directories
34 */
35export declare function cp(source: string | string[], destinationpaths: string | string[], options?: {}): Promise<void>;
36/**
37 * rm -rf
38 */
39export declare function rm(...filesArray: (string | string[])[]): Promise<void>;
40export declare function rmIfEmpty(...filesArray: (string | string[])[]): Promise<void>;
41export declare function mv(source: string | string[], dest: string | string[]): Promise<void>;
42export declare function exists(filepath: string | string[]): Promise<boolean>;
43export declare namespace exists {
44 function sync(filepath: string | string[]): boolean;
45}
46export declare function chmod(filepath: string | string[], mode: number): Promise<void>;
47export declare function ln(from: Filepath, to: Filepath): Promise<void>;
48/**
49 * create a new temporary directory
50 * uses tmp
51 */
52export declare function tmpDir(): Promise<string>;
53export declare function emptyDir(filepath: string | string[]): Promise<void>;
54export declare function hash(algo: string, fp: string | string[]): Promise<string>;