.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @mrmlnc / readdir-enhanced / lib / index.js
1 'use strict';
2
3 const readdirSync = require('./sync');
4 const readdirAsync = require('./async');
5 const readdirStream = require('./stream');
6
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;
14
15 /**
16  * Synchronous readdir that returns an array of string paths.
17  *
18  * @param {string} dir
19  * @param {object} [options]
20  * @returns {string[]}
21  */
22 function readdirSyncPath (dir, options) {
23   return readdirSync(dir, options, {});
24 }
25
26 /**
27  * Synchronous readdir that returns results as an array of {@link fs.Stats} objects
28  *
29  * @param {string} dir
30  * @param {object} [options]
31  * @returns {fs.Stats[]}
32  */
33 function readdirSyncStat (dir, options) {
34   return readdirSync(dir, options, { stats: true });
35 }
36
37 /**
38  * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}).
39  * Results are an array of path strings.
40  *
41  * @param {string} dir
42  * @param {object} [options]
43  * @param {function} [callback]
44  * @returns {Promise<string[]>}
45  */
46 function readdirAsyncPath (dir, options, callback) {
47   return readdirAsync(dir, options, callback, {});
48 }
49
50 /**
51  * Aynchronous readdir (accepts an error-first callback or returns a {@link Promise}).
52  * Results are an array of {@link fs.Stats} objects.
53  *
54  * @param {string} dir
55  * @param {object} [options]
56  * @param {function} [callback]
57  * @returns {Promise<fs.Stats[]>}
58  */
59 function readdirAsyncStat (dir, options, callback) {
60   return readdirAsync(dir, options, callback, { stats: true });
61 }
62
63 /**
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.
66  *
67  * @param {string} dir
68  * @param {object} [options]
69  * @returns {stream.Readable}
70  */
71 function readdirStreamPath (dir, options) {
72   return readdirStream(dir, options, {});
73 }
74
75 /**
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.
78  *
79  * @param {string} dir
80  * @param {object} [options]
81  * @returns {stream.Readable}
82  */
83 function readdirStreamStat (dir, options) {
84   return readdirStream(dir, options, { stats: true });
85 }