Skip to content

Instantly share code, notes, and snippets.

View thesmart's full-sized avatar

John Smart thesmart

View GitHub Profile
@thesmart
thesmart / readdirSyncRecursive
Created November 27, 2012 04:28
readdirSyncRecursive - Recurse through a directory and populate an array with all the file paths beneath
/**
* Recurse through a directory and populate an array with all the file paths beneath
* @param {string} path The path to start searching
* @param {array} allFiles Modified to contain all the file paths
*/
function readdirSyncRecursive(path, allFiles) {
var stats = fs.statSync(path);
if (stats.isFile()) {
// base case
allFiles.push(path);