Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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.")
  }
})
Source by coderrocketfuel.com #
 
PREVIOUS NEXT
Tagged: #check #folder #exists #node #js
ADD COMMENT
Topic
Name
2+5 =