forked from enviPath/enviPy
Current Dev State
This commit is contained in:
24
static/js/ketcher2/node_modules/fs-exists-cached/index.js
generated
vendored
Normal file
24
static/js/ketcher2/node_modules/fs-exists-cached/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
module.exports = exists
|
||||
exists.sync = sync
|
||||
var fs = require('fs')
|
||||
var existsCache = Object.create(null)
|
||||
|
||||
function exists (file, cb) {
|
||||
if (file in existsCache)
|
||||
return process.nextTick(cb.bind(null, existsCache[file]))
|
||||
fs.lstat(file, function (er) {
|
||||
cb(existsCache[file] = !er)
|
||||
})
|
||||
}
|
||||
|
||||
function sync (file) {
|
||||
if (file in existsCache)
|
||||
return existsCache[file]
|
||||
try {
|
||||
fs.lstatSync(file)
|
||||
existsCache[file] = true
|
||||
} catch (er) {
|
||||
existsCache[file] = false
|
||||
}
|
||||
return existsCache[file]
|
||||
}
|
||||
Reference in New Issue
Block a user