I already have read the documentation of Node.js and, unless if I missed something, it does not tell what the parameters contain in certain operations, in particular fs.mkdi
@Liberateur's answer above did not work for me (Node v8.10.0). Little modification did the trick but I am not sure if this is a right way. Please suggest.
// Get modules node
const fs = require('fs');
const path = require('path');
// Create
function mkdirpath(dirPath)
{
try {
fs.accessSync(dirPath, fs.constants.R_OK | fs.constants.W_OK);
}
catch(err) {
try
{
fs.mkdirSync(dirPath);
}
catch(e)
{
mkdirpath(path.dirname(dirPath));
mkdirpath(dirPath);
}
}
}
// Create folder path
mkdirpath('my/new/folder/create');