mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
19 lines
646 B
JavaScript
19 lines
646 B
JavaScript
var fs = require("fs");
|
|
var path = require("path");
|
|
|
|
// Utility function that collects the stats of every file in a directory
|
|
// as well as in its subdirectories.
|
|
function getFilesInFolder(folderName, fileList) {
|
|
var folderFiles = fs.readdirSync(folderName);
|
|
folderFiles.forEach(function(file) {
|
|
var fileStats = fs.statSync(path.join(folderName, file));
|
|
if (fileStats.isDirectory()) {
|
|
getFilesInFolder(path.join(folderName, file), fileList);
|
|
} else {
|
|
fileStats.path = path.join(folderName, file);
|
|
fileList.push(fileStats);
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = getFilesInFolder; |