sindresorhus/file-type

Filetype return undefined with .npy file

xanhz opened this issue · 2 comments

xanhz commented

.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

I have same problem, how to solve it?

xanhz commented

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.