INNER CODE UNIT · JavaScript
getAllJsonFiles
ImranR98/apps.obtainium.imranr.dev · scripts/validate_icons.js:19
function getAllJsonFiles(dir) {
const results = []
const items = fs.readdirSync(dir)
for (const item of items) {
const fullPath = path.join(dir, item)
const stat = fs.statSync(fullPath)
if (stat.isDirectory()) {
results.push(...getAllJsonFiles(fullPath))
} else if (item.endsWith('.json')) {
results.push(fullPath)
}
}
return results
}
function isIco(buffer, contentType) {
const type = (contentType || '').toLowerCase()
if (type.includes('image/x-icon') || type.includes('image/vnd.microsoft.icon')) return true