create folder dynamically in node js code example
Example 1: node js create folder
var fs = require('fs');
const dir = './database/temp';
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, {
recursive: true
});
}
Example 2: how to create a folder using fs in node js
//Include fs module
const fs = require('fs');
const dir = './dir'
fs.mkdir(dir);