0.1.1 • Published 6 years ago
nano-exists v0.1.1
nano-exists
An async/await wrapper to check if something in the filesystem exists.
Getting Started
This is how we roll:
Installing
$ npm i nano-exists
Usage
const exists = require('nano-exists')('fs');
(async () => {
try{
await console.log(await exists.check(process.argv[2]));
} catch (err) {
return console.log(err);
}
})();
Instead of fs you could use any other filesystem module which has the method fs.accesSync()
, such as fs-extra. Just replace
const exists = require('nano-exists')('fs');
with
const exists = require('nano-exists')('fs-extra');
API
check(path)
Returns a boolean in an async matter wether path
exists or not.
If path
exists returns true
else returns false
.
Tests
$ npm run test
Built With
- vardrop/license-checker-cli shameless selfpromoting
- siddharthkp/cost-of-modules calculating the cost
- chai & mocha for unit testing