Expose manifest params JSON

This commit is contained in:
2023-11-03 16:15:34 +01:00
parent 4ffc5277c0
commit 6895e69618
3 changed files with 34 additions and 1 deletions

View File

@@ -43,6 +43,24 @@ function extractDNOMetadata(imgFilename) {
date: '',
}
}
/**
* Retrieves available image techniques
* for all papyruses based on folder contents
* @returns {object}
*/
Common.getParamsFromFolders = async function() {
let params = {};
const papyri = await fs.promises.readdir(process.env.IMAGES_DIR);
for (let p of papyri) {
params[p] = [];
for (let tech of await fs.promises.readdir(`${process.env.IMAGES_DIR}/${p}`)) {
params[p].push(tech.toLowerCase().replaceAll('_','-'));
}
}
return params;
}
/**
* @param {string} manifestId
*/