Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 881B

2 år sedan
123456789101112131415161718192021222324252627282930313233
  1. # fs.realpath
  2. A backwards-compatible fs.realpath for Node v6 and above
  3. In Node v6, the JavaScript implementation of fs.realpath was replaced
  4. with a faster (but less resilient) native implementation. That raises
  5. new and platform-specific errors and cannot handle long or excessively
  6. symlink-looping paths.
  7. This module handles those cases by detecting the new errors and
  8. falling back to the JavaScript implementation. On versions of Node
  9. prior to v6, it has no effect.
  10. ## USAGE
  11. ```js
  12. var rp = require('fs.realpath')
  13. // async version
  14. rp.realpath(someLongAndLoopingPath, function (er, real) {
  15. // the ELOOP was handled, but it was a bit slower
  16. })
  17. // sync version
  18. var real = rp.realpathSync(someLongAndLoopingPath)
  19. // monkeypatch at your own risk!
  20. // This replaces the fs.realpath/fs.realpathSync builtins
  21. rp.monkeypatch()
  22. // un-do the monkeypatching
  23. rp.unmonkeypatch()
  24. ```