Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node js create folder

var fs = require('fs');

const dir = './database/temp';
if (!fs.existsSync(dir)) {
	fs.mkdirSync(dir, {
		recursive: true
	});
}
Comment

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');
Comment

node.js fs create directory

import fs from "fs";
const fsp = fs.promises;

const makeDir = async () => {
    try {
        await fsp.mkdir('blogPost')
    } catch (err) {
        console.log(err);
    }
}

makeDir()
Comment

how to create a folder in node js

const fs = require("fs");

if (!fs.existsSync(dirName)) fs.mkdirSync(dirName, { recursive: true });
Comment

how to create a folder using fs in node js

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

const dir = './dir'
fs.mkdir(dir);
Comment

PREVIOUS NEXT
Code Example
Javascript :: adb bootloader reboot 
Javascript :: file upload with angular material 
Javascript :: conditional object spread 
Javascript :: fetch post 
Javascript :: javascript get last url segment 
Javascript :: javascript range of integers with spread 
Javascript :: js localstorage 
Javascript :: node js timestamp format 
Javascript :: jquery summernote set value 
Javascript :: javascript form submit on button click check if required fields not empty 
Javascript :: javascript alert on refresh 
Javascript :: how to validate a string using regular expression in javascript 
Javascript :: Tribonacci Sequence in JavaScript 
Javascript :: javascript flatten an array 
Javascript :: react include a polyfill webpack v5 
Javascript :: json javascript 
Javascript :: refresh page and run function after javascript 
Javascript :: javascript write all the prime numbers from 1 to 100 
Javascript :: insert image into datatable 
Javascript :: csurf npm 
Javascript :: localstorage remove item 
Javascript :: js number with four decimal places 
Javascript :: how to create a random number generator in javascript 
Javascript :: prime number js 
Javascript :: c# write json to file 
Javascript :: jquery siblings 
Javascript :: js cound how many clicks 
Javascript :: any click event jquery 
Javascript :: javascript get placeholder value 
Javascript :: node mssql 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =