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 :: javascript check if not undefined 
Javascript :: ERROR in ./server/server.js Module build failed (from ./node_modules/babel-loader/lib/index.js): 
Javascript :: jquery check if checkbox is checked 
Javascript :: list of currencies with code js 
Javascript :: express req ip address 
Javascript :: document on click 
Javascript :: Slick slider arrows change 
Javascript :: vertical align center react native view 
Javascript :: angular pipe for 2 decimal places 
Javascript :: on resize jquery 
Javascript :: format money javascript commas 
Javascript :: jquery on body click 
Javascript :: hr react 
Javascript :: regex to allow only numbers letters and hyphen 
Javascript :: react install 
Javascript :: how to install robotjs 
Javascript :: js scroll to top 
Javascript :: check if a date time string is a valid date in js 
Javascript :: play sound javascript 
Javascript :: async iife 
Javascript :: link next js target _blank 
Javascript :: how to pass laravel route name to ajax request 
Javascript :: fetch get authorization header 
Javascript :: js get element distance from top 
Javascript :: convert text filed to password field in jquery 
Javascript :: react native rotate image 
Javascript :: javascript insert sibling after 
Javascript :: convert english number to bangla in javascript 
Javascript :: Reset reCAPTCHA js 
Javascript :: isoddjs 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =