Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use node js to check if a json file exists

const fs = require('fs')

const path = './file.txt'

try {
  if (fs.existsSync(path)) {
    //file exists
  }
} catch(err) {
  console.error(err)
}
Source by flaviocopes.com #
 
PREVIOUS NEXT
Tagged: #node #js #check #json #file #exists
ADD COMMENT
Topic
Name
8+3 =