sindresorhus / file-type

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

Filetype return undefined with .npy file #618

Closed xanhz closed 7 months ago

xanhz commented 8 months ago

.npy file has application/octet-stream mimetype but actually it returns undefined

const { fromFile } = require('file-type');

fromFile('foo.npy').then((filetype) => console.log(filetype?.mime)) // expect application/octet-stream
Datodia commented 7 months ago

I have same problem, how to solve it?

xanhz commented 7 months ago

I have same problem, how to solve it? Because .npy files do not have header to use magic number. So to fix this problem I use mime-types to get from file path.