Filesystem.ls()

List contents of a directory on the local filesystem.

Usage

Hover over inputs/exits for more info.

var Filesystem = require('machinepack-fs');


// List contents of a directory on the local filesystem.

Filesystem.ls({

dir: '/Users/mikermcneil/.tmp/foo',

depth: 1,

includeFiles: true,

includeDirs: true,

includeSymlinks: true,

includeHidden: false,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Nothing exists at the specified directory path.

doesNotExist: function () {

 

},

// OK.

success: function (dirContents) {

 

},

});

Inputs

dir required

Path to the directory whose contents should be listed.

'/Users/mikermcneil/.tmp/foo'
depth

The maximum number of "hops" (i.e. directories deep) to include directory contents from.

1
includeFiles

Whether or not to include files

true
includeDirs

Whether or not to include directories

true
includeSymlinks

Whether or not to include symbolic links

true
includeHidden

Whether or not to include hidden files/directories/symlinks

false

Exits

error

An unexpected error occurred.

doesNotExist

Nothing exists at the specified directory path.

success

OK.

[ '/Users/mikermcneil/.tmp/foo/.gitignore' ]