Properly request only the first 1024 bytes when getting image type
This commit is contained in:
parent
dd114e27b5
commit
2a3f84f628
1 changed files with 3 additions and 1 deletions
|
@ -93,7 +93,9 @@ exports.getType = async (image) => {
|
||||||
controller.abort();
|
controller.abort();
|
||||||
}, 25000);
|
}, 25000);
|
||||||
try {
|
try {
|
||||||
const imageRequest = await fetch(image, { signal: controller.signal, highWaterMark: 512 });
|
const imageRequest = await fetch(image, { signal: controller.signal, headers: {
|
||||||
|
"Range": "bytes=0-1023"
|
||||||
|
}});
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
const imageBuffer = await imageRequest.buffer();
|
const imageBuffer = await imageRequest.buffer();
|
||||||
const imageType = await fileType.fromBuffer(imageBuffer);
|
const imageType = await fileType.fromBuffer(imageBuffer);
|
||||||
|
|
Loading…
Reference in a new issue