forked from bpedro/node-fs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
32 lines (29 loc) · 694 Bytes
/
example.js
File metadata and controls
32 lines (29 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Require our fs lib, not the original.
//
var fs = require('./lib/fs');
//
// Example with non-recursion.
//
fs.mkdir('/tmp/example_dir/first/second/third/fourth/fifth', 0777, function (err) {
if (err) {
console.log(err);
} else {
console.log('Directory created');
}
});
//
// Example with recursion -- notice the parameter
// right before the callback function.
//
fs.mkdir('/tmp/example_dir/first/second/third/fourth/fifth', 0777, true, function (err) {
if (err) {
console.log(err);
} else {
console.log('Directory created');
}
});
//
// Synchronous example with recursion.
//
fs.mkdirSync('/tmp/example_sync/first/second/third/fourth/fifth', 0777, true);