This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original gist: https://gist.github.com/825583 | |
// I've added support for empty directories | |
// i.e. when `start` dir was empty callback was not fired, | |
// now it is fired like this: callback(null, {dirs: [], files: []}) | |
function readDir(start, callback) { | |
// Use lstat to resolve symlink if we are passed a symlink | |
fs.lstat(start, function(err, stat) { | |
if(err) { | |
return callback(err); | |
} |