Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
757 bytes
|
Line | |
---|
1 | # memory-fs
|
---|
2 |
|
---|
3 | A simple in-memory filesystem. Holds data in a javascript object.
|
---|
4 |
|
---|
5 | ``` javascript
|
---|
6 | var MemoryFileSystem = require("memory-fs");
|
---|
7 | var fs = new MemoryFileSystem(); // Optionally pass a javascript object
|
---|
8 |
|
---|
9 | fs.mkdirpSync("/a/test/dir");
|
---|
10 | fs.writeFileSync("/a/test/dir/file.txt", "Hello World");
|
---|
11 | fs.readFileSync("/a/test/dir/file.txt"); // returns Buffer("Hello World")
|
---|
12 |
|
---|
13 | // Async variants too
|
---|
14 | fs.unlink("/a/test/dir/file.txt", function(err) {
|
---|
15 | // ...
|
---|
16 | });
|
---|
17 |
|
---|
18 | fs.readdirSync("/a/test"); // returns ["dir"]
|
---|
19 | fs.statSync("/a/test/dir").isDirectory(); // returns true
|
---|
20 | fs.rmdirSync("/a/test/dir");
|
---|
21 |
|
---|
22 | fs.mkdirpSync("C:\\use\\windows\\style\\paths");
|
---|
23 | ```
|
---|
24 |
|
---|
25 | ## License
|
---|
26 |
|
---|
27 | Copyright (c) 2012-2014 Tobias Koppers
|
---|
28 |
|
---|
29 | MIT (http://www.opensource.org/licenses/mit-license.php)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.