Check if a directory exists - synchronously or asynchronously
Install
$ npm install --save directory-exists
Usage:
directory
should be a string of a relative or absolute path.
Asynchronous
With Callback:
const directoryExists = ; ;
With Promise:
If no callback function is supplied, directoryExists returns a promise.
const directoryExists = ; ;
Async/await:
const directoryExists = ; { const result = await ; console; // result is a boolean};
Synchronous
const directoryExists = ; directoryExists; // retuns a boolean
fs.exists
?
Why not use Because asynchronous fs.exists
is deprecated. Synchronous fs.existsSync
is still fine to use, but this library does both sync and async.
License
MIT © timmydoza