Updated file-type

This commit is contained in:
TheEssem 2020-01-19 09:40:40 -06:00
parent 0343d3b0f6
commit 4df084a427
3 changed files with 90 additions and 34 deletions

View file

@ -9,7 +9,7 @@ const typeCheck = async (image) => {
const imageBuffer = await imageRequest.buffer();
try {
// get the file type
const imageType = fileType(imageBuffer);
const imageType = await fileType.fromBuffer(imageBuffer);
// check if the file is a jpeg, png, or webp
if (imageType && ["image/jpeg", "image/png", "image/webp", "image/gif"].includes(imageType.mime)) {
// if it is, then return the url with the file type