https://github.com/streamich/nodefs
THIS IS OLD, USE streamich/memfs INSTEAD
https://github.com/streamich/nodefs
Last synced: 11 months ago
JSON representation
THIS IS OLD, USE streamich/memfs INSTEAD
- Host: GitHub
- URL: https://github.com/streamich/nodefs
- Owner: streamich
- Created: 2015-06-07T00:38:18.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-05T09:30:42.000Z (over 8 years ago)
- Last Synced: 2025-08-09T12:29:54.812Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> THIS IS OLD, USE [`streamich/memfs`](https://github.com/streamich/memfs) INSTEAD
>
> THIS IS OLD, USE [`streamich/memfs`](https://github.com/streamich/memfs) INSTEAD
>
> THIS IS OLD, USE [`streamich/memfs`](https://github.com/streamich/memfs) INSTEAD
# Virtual File System for Node.js
Mount virtual files to your `fs` filesystem.
```javascript
var nodefs = require("nodefs");
var layer = {
"test/index.js": "console.log('Hello World!')",
"text.txt": "Hello again!"
// ...
};
nodefs.mount("./", layer);
require("./test/index.js"); // Hello World!
var fs = require("fs");
console.log(fs.readFileSync("text.txt").toString()); // Hello again!
```
Why is it useful? It is used in `nodefs-drive` package to pack your Node.js projects into a single `.js` file.
When you run the file, `nodefs` creates the virtual file system and you app runs as if it was running from your hard drive.
# TODOs
- Crate a light version with only `fs.readFileSync`, `fs.statSync`, and `fs.realpathSync`.
- Implement the rest of the mehtods.
- Crate a version with *read-only* file system.
- Split project in multiple packages, lets say: (1) *in-memory* file system; (2) *read-only* file system; (3) etc..,
and (4) a *union* file system that can combine then all together with `fs` module.