Skip to content

Instantly share code, notes, and snippets.

AndrewRayCode / gist:825583
Created Feb 14, 2011
recursive read directory in node.js returning flattened list of files and directories
View gist:825583
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);
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {
You can’t perform that action at this time.