nodeJS membuat folder jika tidak ada
var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
Annoyed Alpaca
var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
var fs = require('fs');
const dir = './database/temp';
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, {
recursive: true
});
}
var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
// or if complains about existence and nesting doesn't matter:
var shell = require('shelljs');
shell.mkdir('-p', 'root/parent/tmp');
//Include fs module
const fs = require('fs');
const dir = './dir'
fs.mkdir(dir);