Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

fs dir exists

import fs from 'fs'

if (fs.existsSync(path)) {
    // Do something
}
Comment

how to check if a folder exists in node js

const fs = require("fs")

fs.access("./directory-name", function(error) {
  if (error) {
    console.log("Directory does not exist.")
  } else {
    console.log("Directory exists.")
  }
})
Comment

Node Folder or file exists

const { exists } = require("fs");  
var fs = require( 'fs' ),
    path = require( 'path' ),
    expect = require( 'expect' ),

  exists(path.join(__dirname, "
ode_modules.bin"), (e) => {
    console.log(e ? "
ode_modules.bin exists" : "
Install missing packages
");
  });
Comment

PREVIOUS NEXT
Code Example
Javascript :: eslint ignore current line 
Javascript :: document load javascript 
Javascript :: process memory usage javascript 
Javascript :: js greater than or equal to 
Javascript :: get unique numbers of an array in javascript using for loop 
Javascript :: how to delete first key in hashmap in javascript 
Javascript :: array comprehension javascript 
Javascript :: jquery create input hidden 
Javascript :: javascript grab only even array index 
Javascript :: easyui datagrid double click cell 
Javascript :: jquery is checked 
Javascript :: jquery when any key is pressed 
Javascript :: javascript regex wrap string 
Javascript :: get width of a dom element js 
Javascript :: javascript sort by id 
Javascript :: create hash password in js 
Javascript :: dynamic component angular parameters 
Javascript :: delete attribute javascript 
Javascript :: node:internal/crypto/hash:67 this[kHandle] = new _Hash(algorithm, xofLen); 
Javascript :: how to resize react icons 
Javascript :: check if 2 arrays are equal javascript 
Javascript :: react change button color on hover 
Javascript :: javascript center text 
Javascript :: redirect not found in react-router-dom 
Javascript :: check if input is required jquery 
Javascript :: convert shp to geojson python 
Javascript :: you have no internet connection angular 
Javascript :: downgrade react version to 17 
Javascript :: javascript radio button change event 
Javascript :: event listener for element lost focus 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =