How to use the exists function from graceful-fs

Find comprehensive JavaScript graceful-fs.exists code examples handpicked from public code repositorys.

58
59
60
61
62
63
64
65
66
67
exports.exists = function (filename, callback) {
  if (typeof callback === 'function') {
    return fs.exists(filename, callback)
  }
  return new Promise(resolve => {
    return fs.exists(filename, resolve)
  })
}

// fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
fork icon808
star icon0
watch icon93

+ 41 other calls in file

7
8
9
10
11
12
13
14
15
16
    if (err) return callback(err)
    callback(null)
  })
}

fs.exists(dstpath, function (destinationExists) {
  if (destinationExists) return callback(null)
  fs.lstat(srcpath, function (err, stat) {
    if (err) {
      err.message = err.message.replace('lstat', 'ensureLink')
fork icon0
star icon0
watch icon1

+ 19 other calls in file