Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deebloo/virtual-fs
A file system type interface for dealing with nested values by path
https://github.com/deebloo/virtual-fs
Last synced: 15 days ago
JSON representation
A file system type interface for dealing with nested values by path
- Host: GitHub
- URL: https://github.com/deebloo/virtual-fs
- Owner: deebloo
- License: mit
- Created: 2018-11-21T21:31:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:18:16.000Z (about 1 year ago)
- Last Synced: 2024-11-01T11:51:34.432Z (2 months ago)
- Language: TypeScript
- Size: 676 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-virtual-fs
A file system type interface for dealing with nested values by path
```BASH
npm i simple-virtual-fs
```#### Example:
```TS
import { VirtualFs } from 'simple-virtual-fs';const fs = new VirtualFs()
.add('/foo/first', 1)
.add('/foo/second', 2)
.add('/foo/third', 3)
.add('/bar/fourth', 4)
.map(item => item * 2 : 0);const res = fs.getChildren('/foo'); // ['/foo/first', '/foo/second', '/foo/third']
res.forEach(path => {
console.log(fs.read(path)) // 2 -> 4 -> 6
});
```### Observe Changes.
```TS
import { VirtualFs } from 'virtual-fs';const fs = new VirtualFs();
fs.observe.subscribe((fs: FakeFs) => {
// returns initial instance and then triggers when anything the instance updates
});fs.add('/foo/first', 1)
.add('/foo/second', 2)
.add('/foo/third', 3)
.add('/bar/fourth', 4);```