Package Exports
- memfs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (memfs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
memfs
A fs
API to work with virtual in-memory files.
var memfs = require('memfs');
var mem = new memfs.Volume;
mem.mountSync('./', {
"test.js": "console.log(123);",
"dir/hello.js": "console.log('hello world');"
});
console.log(mem.readFileSync('./dir/hello.js').toString());
Use it together with unionfs
:
var unionfs = require('unionfs');
var fs = require('fs');
// Create a union of two file systems:
unionfs
.use(fs)
.use(mem);
// Now `unionfs` has the `fs` API but on both file systems.
console.log(unionfs.readFileSync('./test.js').toString()); // console.log(123);
// Replace `fs` with the union of thos file systems.
unionfs.replace(fs);
// Now you can do this.
console.log(fs.readFileSync('./test.js').toString()); // console.log(123);
// ... and this:
require('./test.js'); // 123