Last active
November 30, 2016 11:30
-
-
Save zmts/9b7476971ce63cf714bc7af9542b4738 to your computer and use it in GitHub Desktop.
fs node js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://nodejs.org/api/fs.html#fs_fs_mkdir_path_mode_callback | |
// fs.mkdir(path[, mode], callback) callback takes only err arg | |
var fs = require('fs'); | |
fs.mkdir('test_dir', function(err) { | |
if (err) { | |
console.log(err) | |
} else { | |
console.log('looks fine') | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback | |
var fs = require('fs'); | |
fs.readdir(__dirname + '/files/img', function (err, files) { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log(files); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment