source/index.js
function(/* dirPath[, mode], callback */) {
            var args = Array.prototype.slice.call(arguments),
                argc = args.length;
            if (argc <= 1) {
                throw new Error("Invalid number of arguments");
            }
            var dirPath = args[0],
                mode = (typeof args[1] === "string") ? args[1] : "node",
                callback = function() {};
            if (typeof args[1] === "function") {
                callback = args[1];
            } else if (argc >= 3 && typeof args[2] === "function") {
                callback = args[2];
            }
            client
                .getDirectoryContents(dirPath)
                .then(function(contents) {
                    var results;
                    if (mode === "node") {
                        results = contents.map(function(statItem) {
                            return statItem.basename;
                        });
                    } else if (mode === "stat") {
                        results = contents.map(__convertStat);
                    } else {
                        throw new Error("Unknown mode: " + mode);
                    }
                    __executeCallbackAsync(callback, [null, results]);
                })
                .catch(callback);
        }
function(/* dirPath[, mode], callback */) {
            var args = Array.prototype.slice.call(arguments),
                argc = args.length;
            if (argc <= 1) {
                throw new Error("Invalid number of arguments");
            }
            var dirPath = args[0],
                mode = (typeof args[1] === "string") ? args[1] : "node",
                callback = function() {};
            if (typeof args[1] === "function") {
                callback = args[1];
            } else if (argc >= 3 && typeof args[2] === "function") {
                callback = args[2];
            }
            client
                .getDirectoryContents(dirPath)
                .then(function(contents) {
                    var results;
                    if (mode === "node") {
                        results = contents.map(function(statItem) {
                            return statItem.basename;
                        });
                    } else if (mode === "stat") {
                        results = contents.map(__convertStat);
                    } else {
                        throw new Error("Unknown mode: " + mode);
                    }
                    __executeCallbackAsync(callback, [null, results]);
                })
                .catch(callback);
        }
function ( /* dirPath[, mode], callback */ ) { var args = Array . prototype . slice . call ( arguments ) , argc = args . length ; if ( argc <= 1 ) { throw new Error ( "Invalid number of arguments" ) ; } var dirPath = args [ 0 ] , mode = ( typeof args [ 1 ] === "string" ) ? args [ 1 ] : "node" , callback = function ( ) { } ; if ( typeof args [ 1 ] === "function" ) { callback = args [ 1 ] ; } else if ( argc >= 3 && typeof args [ 2 ] === "function" ) { callback = args [ 2 ] ; } client . getDirectoryContents ( dirPath ) . then ( function ( contents ) { var results ; if ( mode === "node" ) { results = contents . map ( function ( statItem ) { return statItem . basename ; } ) ; } else if ( mode === "stat" ) { results = contents . map ( __convertStat ) ; } else { throw new Error ( "Unknown mode: " + mode ) ; } __executeCallbackAsync ( callback , [ null , results ] ) ; } ) . catch ( callback ) ; }
Readdir processing mode.
When set to 'node', readdir will return an array of strings like Node's
fs.readdir does. When set to 'stat', readdir will return an array of stat
objects.
@see stat
@typedef {('node'|'stat')} ReadDirMode
 
Read a directory synchronously.
Maps -> fs.readdir
@see https://nodejs.org/api/fs.html#fs_fs_readdir_path_callback
@param {String} path The path to read at
@param {String=} mode The readdir processing mode (default 'node')
@param {Function} callback Callback: function(error, files)
Readdir processing mode . When set to node readdir will return an array of strings like Node s fs . readdir does . When set to stat readdir will return an array of stat objects .