JSPM

fs-exists

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 355
  • Score
    100M100P100Q96538F

Wraps fs.exists so callback is called with (err, result).

Package Exports

  • fs-exists

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs-exists) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs-exists Build Status

Wraps Node.js' native fs.exists so callback is called with (err, result) instead of just (result).
Since it's just wrapping fs.exists, the err argument will always be null.

I developed the module to have a function that can be easily adapted to return a promise (for example with faithful.adapt from my Faithful project), but you may find other uses for it.

Usage

fsExists = require('fs-exists')
fsExists(path, function(err, result) {
  if (err) throw err; // err will always be null
  if(result)
    console.log "the entry exists"
  else
    console.log "the entry does not exist"
})

License

fs-exists is released under the MIT License.
Copyright (c) 2013 Meryn Stol