const fs = require('fs')
const images="images"
const path ='images\palmtunnel.jpg'
if(fs.existsSync(path)){
console.log('exist')
}
else{
console.log('does not exist')
}
this way didn't work just working in the files in the same directory.