diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-10-05 13:10:03 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2017-11-09 11:39:46 +0100 |
commit | 74023c072ccd57ee26dacafbb462572bb05b3ffb (patch) | |
tree | 48df2742f35fb746a4ef4a49d822c8d3c7ceadc9 /test/parallel/test-fs-realpath-native.js | |
parent | 3393b65a6ff85884f2515f94b2d83aec4dcd45ca (diff) | |
download | android-node-v8-74023c072ccd57ee26dacafbb462572bb05b3ffb.tar.gz android-node-v8-74023c072ccd57ee26dacafbb462572bb05b3ffb.tar.bz2 android-node-v8-74023c072ccd57ee26dacafbb462572bb05b3ffb.zip |
fs: expose realpath(3) bindings
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()`
on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the
`fs.realpath.native()` and `fs.realpathSync.native()` functions.
The binding was already available as `process.binding('fs').realpath`
but was not exposed or tested - and partly broken as a result.
Fixes: https://github.com/nodejs/node/issues/8715
PR-URL: https://github.com/nodejs/node/pull/15776
Refs: https://github.com/nodejs/node/pull/7899
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-realpath-native.js')
-rw-r--r-- | test/parallel/test-fs-realpath-native.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/parallel/test-fs-realpath-native.js b/test/parallel/test-fs-realpath-native.js new file mode 100644 index 0000000000..43d6b8ca80 --- /dev/null +++ b/test/parallel/test-fs-realpath-native.js @@ -0,0 +1,12 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); + +if (!common.isOSX) common.skip('MacOS-only test.'); + +assert.strictEqual(fs.realpathSync.native('/users'), '/Users'); +fs.realpath.native('/users', common.mustCall((err, res) => { + assert.ifError(err); + assert.strictEqual(res, '/Users'); +})); |