Answers for "file exists name starting with nodejs"

3

node if file exists

const fs = require("fs"); // Or `import fs from "fs";` with ESM
if (fs.existsSync(path)) {
    // Do something
}
Posted by: Guest on January-13-2021
0

Node Folder or file exists

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

  exists(path.join(__dirname, "\\node_modules\\.bin\\"), (e) => {
    console.log(e ? "\\node_modules\\.bin\\ exists" : "\nInstall missing packages\n");
  });
Posted by: Guest on September-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language