1const fs = require("fs")
2
3fs.access("./directory-name", function(error) {
4 if (error) {
5 console.log("Directory does not exist.")
6 } else {
7 console.log("Directory exists.")
8 }
9})
1const { exists } = require("fs");
2var fs = require( 'fs' ),
3 path = require( 'path' ),
4 expect = require( 'expect' ),
5
6 exists(path.join(__dirname, "\\node_modules\\.bin\\"), (e) => {
7 console.log(e ? "\\node_modules\\.bin\\ exists" : "\nInstall missing packages\n");
8 });