sindresorhus/file-type

blob.arrayBuffer is not a function

Waoweens opened this issue · 1 comments

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)
  • Node v22.3.0 (also happens on Bun v1.1.5)
  • file-type 19.0.0

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

sorry for opening an issue