UNPKG

2.2 kBTypeScriptView Raw
1/// <amd-module name="@angular/compiler-cli/src/ngtsc/file_system/src/node_js_file_system" />
2import { AbsoluteFsPath, FileStats, FileSystem, PathManipulation, PathSegment, PathString, ReadonlyFileSystem } from './types';
3/**
4 * A wrapper around the Node.js file-system that supports path manipulation.
5 */
6export declare class NodeJSPathManipulation implements PathManipulation {
7 pwd(): AbsoluteFsPath;
8 chdir(dir: AbsoluteFsPath): void;
9 resolve(...paths: string[]): AbsoluteFsPath;
10 dirname<T extends string>(file: T): T;
11 join<T extends string>(basePath: T, ...paths: string[]): T;
12 isRoot(path: AbsoluteFsPath): boolean;
13 isRooted(path: string): boolean;
14 relative<T extends PathString>(from: T, to: T): PathSegment | AbsoluteFsPath;
15 basename(filePath: string, extension?: string): PathSegment;
16 extname(path: AbsoluteFsPath | PathSegment): string;
17 normalize<T extends string>(path: T): T;
18}
19/**
20 * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
21 */
22export declare class NodeJSReadonlyFileSystem extends NodeJSPathManipulation implements ReadonlyFileSystem {
23 private _caseSensitive;
24 isCaseSensitive(): boolean;
25 exists(path: AbsoluteFsPath): boolean;
26 readFile(path: AbsoluteFsPath): string;
27 readFileBuffer(path: AbsoluteFsPath): Uint8Array;
28 readdir(path: AbsoluteFsPath): PathSegment[];
29 lstat(path: AbsoluteFsPath): FileStats;
30 stat(path: AbsoluteFsPath): FileStats;
31 realpath(path: AbsoluteFsPath): AbsoluteFsPath;
32 getDefaultLibLocation(): AbsoluteFsPath;
33}
34/**
35 * A wrapper around the Node.js file-system (i.e. the `fs` package).
36 */
37export declare class NodeJSFileSystem extends NodeJSReadonlyFileSystem implements FileSystem {
38 writeFile(path: AbsoluteFsPath, data: string | Uint8Array, exclusive?: boolean): void;
39 removeFile(path: AbsoluteFsPath): void;
40 symlink(target: AbsoluteFsPath, path: AbsoluteFsPath): void;
41 copyFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void;
42 moveFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void;
43 ensureDir(path: AbsoluteFsPath): void;
44 removeDeep(path: AbsoluteFsPath): void;
45 private safeMkdir;
46}