UNPKG

1.65 kBTypeScriptView Raw
1import Promise = require('promise');
2export interface FileSystemEntry {
3 isFile(): boolean;
4 isDirectory(): boolean;
5 isBlockDevice(): boolean;
6 isCharacterDevice(): boolean;
7 isSymbolicLink(): boolean;
8 isFIFO(): boolean;
9 isSocket(): boolean;
10 dev: number;
11 ino: number;
12 mode: number;
13 nlink: number;
14 uid: number;
15 gid: number;
16 rdev: number;
17 size: number;
18 blksize: number;
19 blocks: number;
20 atime: Date;
21 mtime: Date;
22 ctime: Date;
23 birthtime: Date;
24 /**
25 * The filename, e.g. "index.js"
26 */
27 name: string;
28 /**
29 * The asbolute path to the file. Uses "/" on unix and "\\" on most windows. e.g. "C:\\\\Users\\Forbes Lidnesay\File.js"
30 */
31 fullPath: string;
32 /**
33 * The path relative to the starting directory. e.g. "path/to/file.js"
34 *
35 * N.B. "\\" is normalized to "/" even on windows.
36 */
37 path: string;
38}
39export interface Options {
40 filterPath?: (path: string) => boolean;
41 filter?: (entry: FileSystemEntry) => boolean;
42 highWaterMark?: number;
43 ignoreErrors?: boolean;
44}
45export declare function lsrSync(dir: string, options?: Options): Array<FileSystemEntry>;
46export declare type Callback = (err: Error | void | null, result: Array<FileSystemEntry>) => void;
47export default lsrAsync;
48export declare function lsrAsync(dir: string, options: Options, callback: Callback): void;
49export declare function lsrAsync(dir: string, callback: Callback): void;
50export declare function lsrAsync(dir: string, options?: Options): Promise<Array<FileSystemEntry>>;
51export declare function lsrStream(dir: string, options: Options): any;