Answers for "create directory in node js"

8

node js create folder

var fs = require('fs');

const dir = './database/temp';
if (!fs.existsSync(dir)) {
	fs.mkdirSync(dir, {
		recursive: true
	});
}
Posted by: Guest on June-23-2020
6

nodejs make directory

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');
Posted by: Guest on March-30-2020
0

how to create a folder in node js

const fs = require("fs");

if (!fs.existsSync(dirName)) fs.mkdirSync(dirName, { recursive: true });
Posted by: Guest on August-31-2021

Code answers related to "create directory in node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language