npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here ¬Ľ

@alexbinary/file-exists

1.0.2¬†‚Äʬ†Public¬†‚Äʬ†Published

file-exists

Simple and consistent way to check if a file exists ūüĒé

npm GitHub release Build Status dependencies Status devDependencies Status

Uses @alexbinary/promisify by alexbinary

Install

Install using npm or yarn :

$ npm install @alexbinary/file-exists
# or 
$ yarn add @alexbinary/file-exists

Usage

let fileexists = require('@alexbinary/file-exists')
 
// callback
fileexists('/path/to/file', (err, exists) => {
  console.log('file exists: ' + (exists ? 'yes' : 'no'))
})
 
// promise
fileexists('/path/to/file').then((exists) => {
  console.log('file exists: ' + (exists ? 'yes' : 'no'))
})
 
// sync
let exists = fileexists.sync('/path/to/file')
console.log('file exists: ' + (exists ? 'yes' : 'no'))

Documentation

let fileexists = require('@alexbinary/file-exists')

fileexists(filepath)

Checks if a file exists at filepath.

This method supports both Promise and node callback style, and resolves with a boolean true if the file exists, false otherwise.

fileexists.sync(filepath)

Synchronous version. Return boolean true if the file exists, false otherwise.

License

MIT

install

npm i @alexbinary/file-exists

Downloadsweekly downloads

5

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability