# virtual-file-system

> npm package for virtual file systems (directories, files)

Latest version **1.2.10** (published 2022-11-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install virtual-file-system
pnpm add virtual-file-system
yarn add virtual-file-system
bun add virtual-file-system
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2022-11-30 |
| First published | 2022-03-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | magnetenstad |

## Links

- npm: https://www.npmjs.com/package/virtual-file-system
- Repository: https://github.com/magnetenstad/virtual-file-system
- Homepage: https://github.com/magnetenstad/virtual-file-system#readme
- Issues: https://github.com/magnetenstad/virtual-file-system/issues
- npm.io page: https://npm.io/package/virtual-file-system

## Recent versions

- 1.2.10 (latest) — 2022-11-30
- 1.2.9 — 2022-10-07
- 1.2.8 — 2022-09-05
- 1.2.7 — 2022-09-05
- 1.2.6 — 2022-09-05
- 1.2.5 — 2022-09-05
- 1.2.4 — 2022-09-05
- 1.2.3 — 2022-08-23
- 1.2.2 — 2022-08-22
- 1.2.1 — 2022-08-22
- 1.2.0 — 2022-08-22
- 1.1.6 — 2022-04-09
- 1.1.5 — 2022-03-27
- 1.1.4 — 2022-03-27
- 1.1.3 — 2022-03-27
- … 14 more at https://npm.io/package/virtual-file-system/versions

## README

# virtual-file-system

npm package for virtual file systems (directories, files)

```sh
npm i virtual-file-system
```

Exports classes `File` and `Directory`

```ts
export { File, Directory };
declare class File {
  name: string;
  data: string;
  metadata: any;
  location: string;
  constructor(
    name: string,
    data: string,
    options?: {
      location?: string;
    }
  );
  write(location?: string): void;
  static read(path: string): File | null;
  getExtension(): string;
  getNameWithoutExtension(): string;
  getPath(): string;
  toString(): string;
}
declare class Directory {
  name: string;
  location: string;
  files: File[];
  directories: Directory[];
  constructor(name: string, location?: string);
  /**
   * Overwrites existing folder.
   * @param {string} location
   */
  write(location?: string): void;
  writeContents(location?: string): void;
  static read(path: string, exclude?: (RegExp | string)[]): Directory | null;
  getDirectories(name: string): Directory[];
  getDirectory(name: string): Directory | null;
  getFiles(name: RegExp | string): File[];
  getFile(name: RegExp | string): File | null;
  removeFile(file: File): void;
  apply(func: (f: File) => void): void;
  filter(func: (f: File) => boolean): void;
  toString(): string;
}
```

---
_Source: https://npm.io/package/virtual-file-system · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
