enoent
v1.0.0
Published
A simple package which replaces fs.exists
Downloads
156
Readme
enoent
Simple Module which replaces fs.exists
Import
const { exists, existsAsync } = require('enoent')
Usage
// Callback
exists('RANDOMFILE.txt', (result) => {
console.log('RANDOMFILE.txt', result)
})
// Promisified
const result = await existsAsync('RANDOMFILE.txt')
console.log('RANDOMFILE.txt', result)
Replacing the fs function
Put this where you normally would import fs
const fs = require('fs')
fs.exists = require('enoent').exists
And you can use
fs.exists('myfile.txt', (result) => {
console.log(result)
})