2.0.8 • Published 1 year ago

@ricsam/linkfs v2.0.8

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

linkfs

NOTE: This project is an updated fork of linkfs with bug fixes and updates. The original version has not been updated in many years and have a some unresolved issues that are addressed in this fork.

Redirects filesystem paths.

npm install --save @ricsam/linkfs
import { link } from "linkfs";
import { fs } from "memfs";

fs.writeFileSync("/foo", "bar");
const lfs = link(fs, ["/foo2", "/foo"]);
console.log(lfs.readFileSync("/foo2", "utf8")); // bar

Reference

link(fs, rewrites)

Returns a new fs-like object with redirected file paths.

fs is the source fs-like object.

rewrites is a 2-tuple or an array of 2-tuples, where each 2-tuple has a form of [from, to]. from is the new, virtual path; and to is an existing path in the fs filesystem.

const lfs = link(fs, ["/foo", "/bar"]);

or

const lfs = link(fs, [
  ["/foo1", "/bar1"],
  ["/foo2", "/bar2"],
  ["/foo3", "/bar3"],
]);

License

Unlicense - public domain.

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago