Archived
This commit is contained in:
1 parent
460f47683c
commit
0ffcafdf3f
3 files changed
+64
-42
No files matched your search
+9
-2
@@ -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