Code files

This commit is contained in:
Akhil
2017-07-31 11:33:31 +05:30
parent 073a63ebdd
commit b9ae409ec0
801 changed files with 17535 additions and 0 deletions
@@ -0,0 +1,17 @@
'use strict'
const fs = require('fs')
const exists = (file) => new Promise((resolve, reject) => {
fs.access(file, (err) => {
if (err) {
if (err.code !== 'ENOENT') { return reject(err) }
return resolve({file, exists: false})
}
resolve({file, exists: true})
})
})
exists(process.argv[2])
.then(({file, exists}) => console.log(`"${file}" does${exists ? '' : ' not'} exist`))
.catch(console.error)