async function getAllFilesContentsForService()

in wiki-interface/lib/file/file.js [49:75]


async function getAllFilesContentsForService(dirPath, uuid) {
    let repoContent = "";

    const files = fs.readdirSync(dirPath);

    for (const file of files) {
        const filePath = path.join(dirPath, file);

        // Check if it's a directory
        if (fs.lstatSync(filePath).isDirectory()) {
            // Recursively call the function for subdirectories
            if (await configExcl.filterPath(file)) {
                await getAllFilesContentsForService(filePath, uuid);
            }
        } else if (await configExcl.filterPath(file) && await configIncl.filterPath(file)) {
            // Read the file content
            let fileContent = fs.readFileSync(filePath, 'utf-8');
            // Add the file content to the string
            repoContent += "\n---------- " + filePath + " ----------\n";
            repoContent += fileContent;
            repoContent += "\n---------- SEPARATOR ----------\n";

        }
    }

    return repoContent;
}