class method FsTools.mkdir
FsTools.mkdir(path, mode, callback) → void
FsTools.mkdir(path, callback) → void
- path (String): Path to create
- mode (String|Number): Permission mode of new directory. See stdlib fs.mkdir for details. Default: '0755'.
- callback (Function): Fired after path was created
Creates given path, creating parents recursively if needed.
Similar to UNIX' mkdir -pf <path>
. After all will fire callback(err)
with
an error if there were any.
Example
fstools.mkdir('/home/nodeca/media/xxx', function (err) {
if (err) {
console.log("Can't' create directory");
console.err(err);
process.exit(1);
} else {
console.log("We can now store some romantic movies here");
process.exit(0);
}
});