index.js
function findAllCompressionFiles(fs, folderPath) {
        // check if folder exists
        if (!fs.existsSync(folderPath))  return; 
        
        var files = fs.readdirSync(folderPath);
        //iterate all files in the current folder
        for (var i = 0; i < files.length; i++) {
            var filePath = folderPath + "/" + files[i];
            var stats = fs.statSync(filePath);
            if (stats.isDirectory()) {
                //recursively search folders and append the matching files
                findAllCompressionFiles(fs, filePath);
            } else {
                addAllMatchingCompressionsToFile(files[i], filePath);
            }
        }
    }
function findAllCompressionFiles(fs, folderPath) {
        // check if folder exists
        if (!fs.existsSync(folderPath))  return; 
        
        var files = fs.readdirSync(folderPath);
        //iterate all files in the current folder
        for (var i = 0; i < files.length; i++) {
            var filePath = folderPath + "/" + files[i];
            var stats = fs.statSync(filePath);
            if (stats.isDirectory()) {
                //recursively search folders and append the matching files
                findAllCompressionFiles(fs, filePath);
            } else {
                addAllMatchingCompressionsToFile(files[i], filePath);
            }
        }
    }
function findAllCompressionFiles ( fs , folderPath ) { // check if folder exists if ( ! fs . existsSync ( folderPath ) ) return ; var files = fs . readdirSync ( folderPath ) ; //iterate all files in the current folder for ( var i = 0 ; i < files . length ; i ++ ) { var filePath = folderPath + "/" + files [ i ] ; var stats = fs . statSync ( filePath ) ; if ( stats . isDirectory ( ) ) { //recursively search folders and append the matching files findAllCompressionFiles ( fs , filePath ) ; } else { addAllMatchingCompressionsToFile ( files [ i ] , filePath ) ; } } }
Picks all files into the matching compression's file list. Search is done recursively!
@param {Object} fs: node.fs
@param {string} folderPath
Picks all files into the matching compression s file list . Search is done recursively!