Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
881 bytes
|
Line | |
---|
1 | # fs.realpath
|
---|
2 |
|
---|
3 | A backwards-compatible fs.realpath for Node v6 and above
|
---|
4 |
|
---|
5 | In Node v6, the JavaScript implementation of fs.realpath was replaced
|
---|
6 | with a faster (but less resilient) native implementation. That raises
|
---|
7 | new and platform-specific errors and cannot handle long or excessively
|
---|
8 | symlink-looping paths.
|
---|
9 |
|
---|
10 | This module handles those cases by detecting the new errors and
|
---|
11 | falling back to the JavaScript implementation. On versions of Node
|
---|
12 | prior to v6, it has no effect.
|
---|
13 |
|
---|
14 | ## USAGE
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | var rp = require('fs.realpath')
|
---|
18 |
|
---|
19 | // async version
|
---|
20 | rp.realpath(someLongAndLoopingPath, function (er, real) {
|
---|
21 | // the ELOOP was handled, but it was a bit slower
|
---|
22 | })
|
---|
23 |
|
---|
24 | // sync version
|
---|
25 | var real = rp.realpathSync(someLongAndLoopingPath)
|
---|
26 |
|
---|
27 | // monkeypatch at your own risk!
|
---|
28 | // This replaces the fs.realpath/fs.realpathSync builtins
|
---|
29 | rp.monkeypatch()
|
---|
30 |
|
---|
31 | // un-do the monkeypatching
|
---|
32 | rp.unmonkeypatch()
|
---|
33 | ```
|
---|
Note:
See
TracBrowser
for help on using the repository browser.