UNPKG

2.58 kBTypeScriptView Raw
1/// <reference types="node" />
2import $fs from 'fs';
3import { URL } from 'url';
4export declare const Constants: typeof $fs.constants;
5export declare type PathLike = $fs.PathLike | string;
6export interface Descriptor {
7 path: string;
8 stats: $fs.Stats;
9}
10export declare class FileSystem {
11 private readonly fs;
12 constructor(fs: any);
13 append(path: string | number | Buffer | URL, data: any, throws?: boolean): Promise<boolean>;
14 basename(path: string, ext?: string | boolean): string;
15 chmod(path: PathLike, mode: number | string): Promise<void>;
16 close(fd: number, throws?: boolean): Promise<boolean>;
17 delete(path: PathLike, throws?: boolean): Promise<boolean>;
18 dirname(filepath: string): string;
19 exists(path: PathLike, throws?: boolean, mode?: number): Promise<boolean>;
20 ext(filename: string): string;
21 file(path: string, content: string, throws?: boolean): Promise<boolean>;
22 glob(pattern: string, cwd?: string): Promise<string[]>;
23 globs(patterns: string[], cwd?: string): Promise<string[]>;
24 list(path: PathLike): Promise<string[]>;
25 info(path: PathLike): Promise<Descriptor>;
26 join(...paths: string[]): string;
27 json<T>(path: string | number | Buffer | URL): Promise<T>;
28 mkdir(path: PathLike, mode?: number | string, throws?: boolean): Promise<boolean>;
29 mkdirs(paths: string[], mode?: number | string, throws?: boolean): Promise<boolean>;
30 mkdirp(path: string, throws?: boolean): Promise<boolean>;
31 mkdirps(paths: string[], throws?: boolean): Promise<boolean>;
32 open(path: PathLike, flags: string | number, mode?: string | number): Promise<number>;
33 read<T extends Buffer | Uint8Array>(fd: number, buffer: T, offset: number, length: number, position: number): Promise<number>;
34 readFile(path: string | number | Buffer | URL): Promise<Buffer>;
35 relative(from: string, to: string): string;
36 relativeFrom(to: string): string;
37 rename(original: PathLike, filename: PathLike, throws?: boolean): Promise<boolean>;
38 resolve(...paths: string[]): string;
39 save<T>(path: string, object: T, throws?: boolean): Promise<boolean>;
40 stat(path: PathLike): Promise<Descriptor>;
41 stats(...paths: PathLike[]): Promise<Descriptor[]>;
42 text(path: string | number | Buffer | URL): Promise<string>;
43 write<T extends Buffer | Uint8Array>(fd: number, buffer: T, offset?: number, length?: number, position?: number): Promise<number>;
44 writeFile(path: string | number | Buffer | URL, data: any): Promise<void>;
45}
46export declare const fs: FileSystem;
47//# sourceMappingURL=FileSystem.d.ts.map
\No newline at end of file