fs.realpath
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The 'fs.realpath' is a backwards-compatible npm package that allows for the use of Node's fs.realpath with an added advantage of falling back to its built-in JavaScript implementation if the native one fails. This ability to handle both increases its resilience, especially noteworthy when dealing with slow or excessively symlink-looping paths which can raise new and platform-specific errors. It is particularly beneficial when wondering how to use fs.realpath in Node versions prior to v6.
The usage of 'fs.realpath' is quite straightforward. You begin by requiring the 'fs.realpath' as depicted below:
var rp = require('fs.realpath')
To use the async version, use the following method:
rp.realpath(someLongAndLoopingPath, function (er, real) {
// Here, the ELOOP gets handled.
})
For the sync version, employ this technique:
var real = rp.realpathSync(someLongAndLoopingPath)
You can choose to replace the in-built fs.realpath/fs.realpathSync with the 'fs.realpath' modules by using the monkeypatch method and can undo it by employing unmonkeypatch method.
rp.monkeypatch() // Monkeypatch the fs.realpath/fs.realpathSync
rp.unmonkeypatch() // Undo the monkeypatch
Take note that usage of the monkeypatch method is at your own risk!
You can find the 'fs.realpath' docs in the same GitHub repository where the npm package is hosted. Feel free to browse here for more detailed information and any updates that may have been made. Please remember that understanding documentation is essential for effective use of any tool in software development.