# linkfs

> Rewrites filesystem paths

Latest version **2.1.0** (published 2017-11-29) · 0 weekly downloads

## Install

```sh
npm install linkfs
pnpm add linkfs
yarn add linkfs
bun add linkfs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-11-29 |
| First published | 2015-06-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 63 |
| Maintainers | streamich |
| Keywords | fs, file, file system, redirect, rewrite, link, mount, linkfs |

## Links

- npm: https://www.npmjs.com/package/linkfs
- Repository: https://github.com/streamich/linkfs
- Homepage: https://github.com/streamich/linkfs#readme
- Issues: https://github.com/streamich/linkfs/issues
- npm.io page: https://npm.io/package/linkfs

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-11-29
- 2.0.2 — 2017-11-17
- 2.0.1 — 2017-10-22
- 2.0.0 — 2017-08-13
- 0.0.2 — 2015-06-15
- 0.0.1 — 2015-06-14

## README

# linkfs

Redirects filesystem paths.

[![][npm-img]][npm-url] [![][travis-badge]][travis-url]

    npm install --save linkfs

```js
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.

```js
const lfs = link(fs, ['/foo', '/bar']);
```

or

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

[npm-url]: https://www.npmjs.com/package/linkfs
[npm-img]: https://img.shields.io/npm/v/linkfs.svg
[memfs]: https://github.com/streamich/memfs
[unionfs]: https://github.com/streamich/unionfs
[linkfs]: https://github.com/streamich/linkfs
[fs-monkey]: https://github.com/streamich/fs-monkey
[travis-url]: https://travis-ci.org/streamich/linkfs
[travis-badge]: https://travis-ci.org/streamich/linkfs.svg?branch=master



# License

[Unlicense](./LICENSE) - public domain.

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