Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node fs exists

const { promises: Fs } = require('fs')

async function exists (path) {  
  try {
    await Fs.access(path)
    return true
  } catch {
    return false
  }
}

// Example:
const Path = require('path')  
const path = Path.join(__dirname, "existing-file.txt")

await exists(path)  
// true
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if at least one checkbox is checked 
Javascript :: javascript expressions 
Javascript :: jquery remove duplicates from array 
Javascript :: timestamp to date javascript 
Javascript :: how to create a random number generator in javascript 
Javascript :: javascript get intersection of two arrays 
Javascript :: check if is function javascript 
Javascript :: regex domain 
Javascript :: remove underline from hyperlink react 
Javascript :: bootstrap icons react 
Javascript :: copy variable value javascript 
Javascript :: remove double slash from url javascript 
Javascript :: jQuery on right mouse click 
Javascript :: js load js file 
Javascript :: play audio with js 
Javascript :: convert moment info to dd mmm yyyy 
Javascript :: convert iso string to datetime javascript 
Javascript :: placeholder value js 
Javascript :: javascript class constructor 
Javascript :: import typography react 
Javascript :: 3 = signs in javasdcript 
Javascript :: get url in js 
Javascript :: how to add button react native app.js 
Javascript :: async in useeffect 
Javascript :: javascript remove property from object 
Javascript :: semantic ui dropdown value 
Javascript :: js get current timezone offset 
Javascript :: angular bind checkbox 
Javascript :: TypeError: this.authenticate is not a function 
Javascript :: react router redirect 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =