Breaking
-
Requires Node.js 22
-
Dropped Node.js
stream.Readablesupport fromfileTypeFromStream()andfileTypeStream()- These now only accept a web
ReadableStream. Migrate withReadable.toWeb():
// Before import fs from 'node:fs'; fileTypeFromStream(fs.createReadStream('file.mp4')); // After import fs from 'node:fs'; import {Readable} from 'node:stream'; fileTypeFromStream(Readable.toWeb(fs.createReadStream('file.mp4')));
- These now only accept a web
-
Sub-exports (e.g.
file-type/core) have been removed. Import everything fromfile-typedirectly. -
The
ReadableStreamWithFileTypetype has been removed. UseAnyWebReadableByteStreamWithFileTypeinstead. -
Several MIME types have been corrected or normalized:
Type Old MIME New MIME lzapplication/x-lzipapplication/lziplnkapplication/x.ms.shortcutapplication/x-ms-shortcutApple Alias application/x.apple.aliasapplication/x-ft-apple.aliasfbxapplication/x.autodesk.fbxapplication/x-ft-fbxDraco application/vnd.google.dracoapplication/x-ft-dracoMIME subtypes prefixed with
x-ft-are custom types defined by this package (not IANA-registered).
Improvements
- Added detection for Apple iWork files:
.key(Keynote),.pages(Pages),.numbers(Numbers)
Fixes
- Fixed LibreOffice OOXML files being incorrectly detected as ZIP when reading from streams