Updated file-type
This commit is contained in:
parent
0343d3b0f6
commit
4df084a427
3 changed files with 90 additions and 34 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue