UNPKG

1.52 kBTypeScriptView Raw
1import Stats from './Stats';
2import Dirent from './Dirent';
3import { Volume as _Volume, StatWatcher, FSWatcher, IWriteStream, DirectoryJSON, NestedDirectoryJSON } from './volume';
4import { constants } from './constants';
5import type { FsPromisesApi } from './node/types';
6import type * as misc from './node/types/misc';
7export { DirectoryJSON, NestedDirectoryJSON };
8export declare const Volume: typeof _Volume;
9export declare const vol: _Volume;
10export interface IFs extends _Volume {
11 constants: typeof constants;
12 Stats: new (...args: any[]) => Stats;
13 Dirent: new (...args: any[]) => Dirent;
14 StatWatcher: new () => StatWatcher;
15 FSWatcher: new () => FSWatcher;
16 ReadStream: new (...args: any[]) => misc.IReadStream;
17 WriteStream: new (...args: any[]) => IWriteStream;
18 promises: FsPromisesApi;
19 _toUnixTimestamp: any;
20}
21export declare function createFsFromVolume(vol: _Volume): IFs;
22export declare const fs: IFs;
23/**
24 * Creates a new file system instance.
25 *
26 * @param json File system structure expressed as a JSON object.
27 * Use `null` for empty directories and empty string for empty files.
28 * @param cwd Current working directory. The JSON structure will be created
29 * relative to this path.
30 * @returns A `memfs` file system instance, which is a drop-in replacement for
31 * the `fs` module.
32 */
33export declare const memfs: (json?: NestedDirectoryJSON, cwd?: string) => {
34 fs: IFs;
35 vol: _Volume;
36};
37export type IFsWithVolume = IFs & {
38 __vol: _Volume;
39};