@file-services/memory
TypeScript icon, indicating that this package has built-in type declarations

9.4.1 • Public • Published

@file-services/memory

npm version package size

An in-memory, sync/async, file system implementation.

Contains a subset of node's fs API with additional helper functions.

Features:

  • Tiny.
  • Isomorphic. Works in both Node.js and web-browsers.
  • Implements the watch service API (for events).
  • Case insensitive.

Getting started

Install library in project:

npm i @file-services/memory

Then, use the programmatic API:

import { createMemoryFs } from "@file-services/memory";

const fs = createMemoryFs();

// library uses `posix`-style paths
// and exposes a subset of `fs` API
fs.writeFileSync("/file-in-root", "file contents");

// several helper functions are included
fs.populateDirectorySync("/src", {
  "index.ts": "/* source code */",
  "another-file.ts": "/* more source code */",
});

fs.fileExistsSync("/src/another-file.ts"); // returns true

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @file-services/memory

Weekly Downloads

2,569

Version

9.4.1

License

MIT

Unpacked Size

156 kB

Total Files

19

Last publish

Collaborators

  • avi.vahl
  • pistolpete_
  • tomermes
  • cijoe