summaryrefslogtreecommitdiff
path: root/lib/fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fs.js')
-rw-r--r--lib/fs.js27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 5c7d907f5e..34517a17da 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -64,6 +64,7 @@ const {
getDirents,
getOptions,
getValidatedPath,
+ handleErrorFromBinding,
nullCheck,
preprocessSymlinkDestination,
Stats,
@@ -80,6 +81,11 @@ const {
warnOnNonPortableTemplate
} = require('internal/fs/utils');
const {
+ Dir,
+ opendir,
+ opendirSync
+} = require('internal/fs/dir');
+const {
CHAR_FORWARD_SLASH,
CHAR_BACKWARD_SLASH,
} = require('internal/constants');
@@ -122,23 +128,6 @@ function showTruncateDeprecation() {
}
}
-function handleErrorFromBinding(ctx) {
- if (ctx.errno !== undefined) { // libuv error numbers
- const err = uvException(ctx);
- // eslint-disable-next-line no-restricted-syntax
- Error.captureStackTrace(err, handleErrorFromBinding);
- throw err;
- }
- if (ctx.error !== undefined) { // Errors created in C++ land.
- // TODO(joyeecheung): currently, ctx.error are encoding errors
- // usually caused by memory problems. We need to figure out proper error
- // code(s) for this.
- // eslint-disable-next-line no-restricted-syntax
- Error.captureStackTrace(ctx.error, handleErrorFromBinding);
- throw ctx.error;
- }
-}
-
function maybeCallback(cb) {
if (typeof cb === 'function')
return cb;
@@ -1834,7 +1823,6 @@ function createWriteStream(path, options) {
return new WriteStream(path, options);
}
-
module.exports = fs = {
appendFile,
appendFileSync,
@@ -1880,6 +1868,8 @@ module.exports = fs = {
mkdtempSync,
open,
openSync,
+ opendir,
+ opendirSync,
readdir,
readdirSync,
read,
@@ -1913,6 +1903,7 @@ module.exports = fs = {
writeSync,
writev,
writevSync,
+ Dir,
Dirent,
Stats,