Skip to content

Instantly share code, notes, and snippets.

View bhj's full-sized avatar

Brandon Jones bhj

View GitHub Profile
@bhj
bhj / gist:3af04f6998e86debd7ecab4b4a456779
Created February 25, 2017 23:56 — forked from AndrewRayCode/gist:825583
recursive read directory in node.js returning flattened list of files and directories
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) {