0.0.10 • Published 12 years ago
walk-tree-as-promised v0.0.10
walk(folder, [options]) can walk through your file system. For example to list all files and folders (default implementation) or to compute a hash (See hash-tree-as-promised)
Installation
npm install walk-tree-as-promised --save
Usage
var walk = require('walk-tree-as-promised');
walk(__dirname)
.then(function(files) {
// files is an array with all the file and subdirectory names
});Options
syncDefault: false. If you setsync: true, then the synchronous file API functions are used internally. This might be faster on Linux systems. However the function still returns a promise.beforeDefault:undefined.function(callback)that is executed before the walking startsafterDefault:undefined.function(result, callback)that is executed after the walking finishedprocessDirectoryDefault:undefined.function(baseDir, relativePath, stat, entries, callback)that is executed for each directoryprocessFileDefault:undefined.function(baseDir, relativePath, stat, callback)that is executed for each directory
To get a sense of how you can use these functions, have a look at the default implementations.