Sun calculation js library which is fully based on formula from http://aa.quae.nl/en/reken/zonpositie.html
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
515 B
24 lines
515 B
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]
|
|
}
|
|
|