Version 1.1.0 - Ajout de la compatibilité des images
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
This commit is contained in:
11
bin/files.js
11
bin/files.js
@ -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"
|
||||
|
Reference in New Issue
Block a user