Answers for "how to create folders in js"

1

how to make directory in javascript

const fs = require('fs');

// directory path
const dir = './views';

// create new directory
fs.mkdir(dir, (err) => {
    if (err) {
        throw err;
    }
    console.log("Directory is created.");
});
Posted by: Guest on June-01-2021
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 "how to create folders in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language