sindresorhus / file-type

Detect the file type of a file, stream, or data
MIT License
3.64k stars 345 forks source link

blob.arrayBuffer is not a function #632

Closed Waoweens closed 2 months ago

Waoweens commented 2 months ago

hi, i'm trying to use fileTypeFromBlob in the server side:

import { fileTypeFromBlob } from 'file-type';

const bannerType = await fileTypeFromBlob(bannerData);
90 |    async fromBlob(blob) {
91 |            const buffer = await blob.arrayBuffer();
                                 ^
TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)
      at /node_modules/file-type/core.js:91:29
      at fromBlob (/node_modules/file-type/core.js:139:16)
      at fileTypeFromBlob (/node_modules/file-type/core.js:43:9)
Waoweens commented 2 months ago

oops, this is my fault. my Blob is sometimes undefined for some reason

sorry for opening an issue