No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

pathExists.md 643 B

hace 3 años
12345678910111213141516171819202122
  1. # pathExists(file[, callback])
  2. Test whether or not the given path exists by checking with the file system. Like [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal callback signature (err, exists). Uses `fs.access` under the hood.
  3. - `file` `<String>`
  4. - `callback` `<Function>`
  5. ## Example:
  6. ```js
  7. const fs = require('fs-extra')
  8. const file = '/tmp/this/path/does/not/exist/file.txt'
  9. // Promise usage:
  10. fs.pathExists(file)
  11. .then(exists => console.log(exists)) // => false
  12. // Callback usage:
  13. fs.pathExists(file, (err, exists) => {
  14. console.log(err) // => null
  15. console.log(exists) // => false
  16. })
  17. ```