diff options
author | Bryan English <bryan@bryanenglish.com> | 2018-07-28 05:29:32 +0300 |
---|---|---|
committer | Bryan English <bryan@bryanenglish.com> | 2018-08-14 05:18:45 +0300 |
commit | c7944a7a7bd92a446ea81d774ccad31e0e7c8a3f (patch) | |
tree | c7b86a281f2af282e080b34965debcea28caf2b7 /src/node_constants.cc | |
parent | 78584b64d88c0567c46e3cf7bae42aa73927df40 (diff) |
fs: readdir optionally returning type information
readdir and readdirSync now have a "withFileTypes" option, which, when
enabled, provides an array of DirectoryEntry objects, similar to Stats
objects, which have the filename and the type information.
Refs: https://github.com/nodejs/node/issues/15699
PR-URL: https://github.com/nodejs/node/pull/22020
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Diffstat (limited to 'src/node_constants.cc')
-rw-r--r-- | src/node_constants.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node_constants.cc b/src/node_constants.cc index 61aa42a8efb..28d5a9ca4ed 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -1022,6 +1022,16 @@ void DefineSystemConstants(Local<Object> target) { NODE_DEFINE_CONSTANT(target, O_WRONLY); NODE_DEFINE_CONSTANT(target, O_RDWR); + // file types from readdir + NODE_DEFINE_CONSTANT(target, UV_DIRENT_UNKNOWN); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_FILE); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_DIR); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_LINK); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_FIFO); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_SOCKET); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_CHAR); + NODE_DEFINE_CONSTANT(target, UV_DIRENT_BLOCK); + NODE_DEFINE_CONSTANT(target, S_IFMT); NODE_DEFINE_CONSTANT(target, S_IFREG); NODE_DEFINE_CONSTANT(target, S_IFDIR); |