An async/await wrapper to check if something in the filesystem exists.
This is how we roll:
$ npm i nano-exists
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');
Returns a boolean in an async matter wether path
exists or not.
If path
exists returns true
else returns false
.
$ npm run test
- vardrop/license-checker-cli shameless selfpromoting
- siddharthkp/cost-of-modules calculating the cost
- chai & mocha for unit testing