Answers for "node js if folder exists dont do anything if not make one"

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
0

how to create a folder using fs in node js

//Include fs module
const fs = require('fs');

const dir = './dir'
fs.mkdir(dir);
Posted by: Guest on July-28-2020

Code answers related to "node js if folder exists dont do anything if not make one"

Code answers related to "Javascript"

Browse Popular Code Answers by Language