UNPKG

694 BJavaScriptView Raw
1//
2// Require our fs lib, not the original.
3//
4var fs = require('./lib/fs');
5
6//
7// Example with non-recursion.
8//
9fs.mkdir('/tmp/example_dir/first/second/third/fourth/fifth', 0777, function (err) {
10 if (err) {
11 console.log(err);
12 } else {
13 console.log('Directory created');
14 }
15});
16
17//
18// Example with recursion -- notice the parameter
19// right before the callback function.
20//
21fs.mkdir('/tmp/example_dir/first/second/third/fourth/fifth', 0777, true, function (err) {
22 if (err) {
23 console.log(err);
24 } else {
25 console.log('Directory created');
26 }
27});
28
29//
30// Synchronous example with recursion.
31//
32fs.mkdirSync('/tmp/example_sync/first/second/third/fourth/fifth', 0777, true);