mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
30 lines
786 B
Markdown
30 lines
786 B
Markdown
|
# memory-fs
|
||
|
|
||
|
A simple in-memory filesystem. Holds data in a javascript object.
|
||
|
|
||
|
``` javascript
|
||
|
var MemoryFileSystem = require("memory-fs");
|
||
|
var fs = new MemoryFileSystem(); // Optionally pass a javascript object
|
||
|
|
||
|
fs.mkdirpSync("/a/test/dir");
|
||
|
fs.writeFileSync("/a/test/dir/file.txt", "Hello World");
|
||
|
fs.readFileSync("/a/test/dir/file.txt"); // returns Buffer("Hello World")
|
||
|
|
||
|
// Async variants too
|
||
|
fs.unlink("/a/test/dir/file.txt", function(err) {
|
||
|
// ...
|
||
|
});
|
||
|
|
||
|
fs.readdirSync("/a/test"); // returns ["dir"]
|
||
|
fs.statSync("/a/test/dir").isDirectory(); // returns true
|
||
|
fs.rmdirSync("/a/test/dir");
|
||
|
|
||
|
fs.mkdirpSync("C:\\use\\windows\\style\\paths");
|
||
|
```
|
||
|
|
||
|
## License
|
||
|
|
||
|
Copyright (c) 2012-2014 Tobias Koppers
|
||
|
|
||
|
MIT (http://www.opensource.org/licenses/mit-license.php)
|