Detect the file type of a file, stream, or data
The file-type package is a JavaScript library that detects binary file formats by examining magic numbers—the distinctive byte signatures at the beginning of files. It works with files, streams, and data buffers in Node.js and browser environments, supporting detection of numerous modern binary formats like PNG, JPEG, MP3, and many others. The package is built as an ESM module for JavaScript and TypeScript and provides multiple detection methods including `fileTypeFromFile()`, `fileTypeFromBuffer()`, `fileTypeFromStream()`, and `fileTypeFromBlob()`, along with support for custom detectors and tokenizer-based approaches for advanced use cases like HTTP range requests and Amazon S3 access.