Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

3 lat temu
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. ```