Version 1.1.0 - Ajout de la compatibilité des images
All checks were successful
Neutral/pipeline/head This commit looks good

This commit is contained in:
2024-02-20 14:09:50 +01:00
parent 460f47683c
commit 0ffcafdf3f
3 changed files with 64 additions and 42 deletions

View File

@ -163,8 +163,15 @@ module.exports.getFile = function(root) {
if(fs.existsSync(root)) {
try {
return fs.readFileSync(root, "utf-8")
// Check if the file is an image and if it is return the base64
if(mime.lookup(root).includes("image")) {
return "data:" + mime.lookup(root) + ";base64," + fs.readFileSync(root, "base64")
} else {
return fs.readFileSync(root, "utf-8")
}
} catch(err) {
console.log(err)
return "NOT_PERMITTED"