3 const readdirSync = require('./sync');
4 const readdirAsync = require('./async');
5 const readdirStream = require('./stream');
7 module.exports = exports = readdirAsyncPath;
8 exports.readdir = exports.readdirAsync = exports.async = readdirAsyncPath;
9 exports.readdirAsyncStat = exports.async.stat = readdirAsyncStat;
10 exports.readdirStream = exports.stream = readdirStreamPath;
11 exports.readdirStreamStat = exports.stream.stat = readdirStreamStat;
12 exports.readdirSync = exports.sync = readdirSyncPath;
13 exports.readdirSyncStat = exports.sync.stat = readdirSyncStat;
16 * Synchronous readdir that returns an array of string paths.
19 * @param {object} [options]
22 function readdirSyncPath (dir, options) {
23 return readdirSync(dir, options, {});
27 * Synchronous readdir that returns results as an array of {@link fs.Stats} objects
30 * @param {object} [options]
31 * @returns {fs.Stats[]}
33 function readdirSyncStat (dir, options) {
34 return readdirSync(dir, options, { stats: true });
38 * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}).
39 * Results are an array of path strings.
42 * @param {object} [options]
43 * @param {function} [callback]
44 * @returns {Promise<string[]>}
46 function readdirAsyncPath (dir, options, callback) {
47 return readdirAsync(dir, options, callback, {});
51 * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}).
52 * Results are an array of {@link fs.Stats} objects.
55 * @param {object} [options]
56 * @param {function} [callback]
57 * @returns {Promise<fs.Stats[]>}
59 function readdirAsyncStat (dir, options, callback) {
60 return readdirAsync(dir, options, callback, { stats: true });
64 * Aynchronous readdir that returns a {@link stream.Readable} (which is also an {@link EventEmitter}).
65 * All stream data events ("data", "file", "directory", "symlink") are passed a path string.
68 * @param {object} [options]
69 * @returns {stream.Readable}
71 function readdirStreamPath (dir, options) {
72 return readdirStream(dir, options, {});
76 * Aynchronous readdir that returns a {@link stream.Readable} (which is also an {@link EventEmitter})
77 * All stream data events ("data", "file", "directory", "symlink") are passed an {@link fs.Stats} object.
80 * @param {object} [options]
81 * @returns {stream.Readable}
83 function readdirStreamStat (dir, options) {
84 return readdirStream(dir, options, { stats: true });