enoent

1.0.0 • Public • Published

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)
})

Readme

Keywords

Package Sidebar

Install

npm i enoent

Weekly Downloads

24

Version

1.0.0

License

MIT

Unpacked Size

3.96 kB

Total Files

7

Last publish

Collaborators

  • greencoder001