file_magic_number
A Flutter package to detect file types based on their magic number instead of MIME types. Supports Flutter on mobile, desktop, and web without native code.
2.1.0
8.9K downloads/mo
#3078 most downloaded on pub.dev
vicajilau/file_magic_number
What this package is like to depend on
Last release 1 months ago
16 Jul 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 26 of 26 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
26 releases · first in 2025
4 releases in the last 12 months
see the full history below
Release timeline
26 releases · Feb 2025 to Jul 2026Releases
latest 26-
2.1.016 Jul 2026Release notes
Open source →What's Changed
- Bump actions/checkout from 4 to 7 by @dependabot[bot] in #39
- Bump codecov/codecov-action from 5 to 7 by @dependabot[bot] in #40
- Bump file_magic_number from 1.4.2 to 2.0.0 in /example by @dependabot[bot] in #42
- Bump mime from 1.0.6 to 2.0.0 by @dependabot[bot] in #41
- feat: memory optimization, new formats, and dynamic custom type registration by @vicajilau in #44
Full Changelog: v2.0.0...v2.1.0
Release notes
Open source →- Dependency Upgrade: Upgraded
mimedependency to version^2.0.0, resolving version resolution conflicts with Firebase packages andpdf_combiner. - Performance Optimization: Optimized
detectFileTypeFromPathOrBlobto read only the first chunk of bytes (up to 512 bytes) using stream reading. This prevents high memory usage (OOM errors) and significantly improves detection speeds for large files. - New Formats: Added support for Gzip (
.gz), Ogg (.ogg/.ogv), and FLAC (.flac) file detection. - Dynamic Custom Types: Added
FileMagicNumber.registerCustomTypeto allow clients to dynamically register custom extensions, MIME types, and magic numbers from their code. - Internal Cleanup: Utilized and integrated stream reading extensions safely across platforms.
-
2.0.027 Jun 2026Release notes
Open source →What's Changed
- Bump file_picker from 10.3.7 to 10.3.8 in /example by @dependabot[bot] in #33
- Bump file_picker from 10.3.8 to 10.3.10 in /example by @dependabot[bot] in #34
- Bump cupertino_icons from 1.0.8 to 1.0.9 in /example by @dependabot[bot] in #35
- Bump file_picker from 10.3.10 to 11.0.1 in /example by @dependabot[bot] in #36
- Bump file_picker from 11.0.1 to 11.0.2 in /example by @dependabot[bot] in #37
- Bump desktop_drop from 0.7.0 to 0.7.1 in /example by @dependabot[bot] in #38
Full Changelog: v1.4.2...v2.0.0
Release notes
Open source →- Breaking change: Added new file types to
FileMagicNumberTypeenum (docx,xlsx,pptx,html,json,xml,csv,svg,txt,rtf,epub). Since enums are exhaustively matched in Dart 3, switch statements over this enum must handle the new types or define adefaultcase. - Refactor & Internal Rewrite: Replaced custom parser logic and custom reader classes with a pure, cross-platform integration based on the standard
mimepackage (MimeTypeResolverandlookupMimeType) andcross_file(XFile). - Bug Fixes: Fixed false positive issues where JPG or other files containing random byte sequences could match the offset-based signatures of MP4/HEIC.
- Empty File Detection: Empty files are now instantly detected as
FileMagicNumberType.emptyFileregardless of their path extension.
-
1.4.213 Dec 2025Release notes
Open source →- Fixed an issue where MP4 files were not detected. #31.
- Added new test about different complet file types with another files inside (ej: rar with tar)
Release notes
Open source →- Fixed an issue where MP4 files were not detected. #31.
- Added new test about different complet file types with another files inside (ej: rar with tar)
-
1.4.121 Nov 2025Release notes
Open source →- Fixed an error that confused a PDF with a JP2 image inside, with a JP2 file #27.
- Added new test about pdfs with another files inside (ej: pdfs with jp2)
Release notes
Open source →- Fixed an error that confused a PDF with a JP2 image inside, with a JP2 file #27.
- Added new test about pdfs with another files inside (ej: pdfs with jp2)
-
1.4.011 Jul 2025Release notes
Open source →- Fixed an issue where JPEG files were detected as TIFF files #17.
- Added webp support.
- Added AVI support.
- Improved WAV support.
- Added magic number detection byRange.
Release notes
Open source →- Fixed an issue where JPEG files were detected as TIFF files #17.
- Added webp support.
- Added AVI support.
- Improved WAV support.
- Added magic number detection byRange.
-
1.3.219 Jun 2025Release notes
Open source →- Fixed an issue where PDFA files were not detected.
- Removed Cocoapods on example project.
- Fixed an issue loading images on example project.
- Improved file detection in dynamic magic numbers.
Release notes
Open source →- Fixed an issue where PDFA files were not detected.
- Removed Cocoapods on example project.
- Fixed an issue loading images on example project.
- Improved file detection in dynamic magic numbers.
-
1.3.114 Apr 2025Release notes
Open source →- Improved file detection.
- Fixed some private methods that were publicly accessible.
- Updated dependencies.
-
1.3.009 Apr 2025Release notes
Open source →- Added HEIC (High Efficiency Image Coding) support, part of the HEIF (High Efficiency Image File) format.
- Breaking change: Resolved an issue with imports where private files are exposed to be imported.
- Individual files can be dragged and dropped on desktop apps and web app on example project.
Release notes
Open source →- Added HEIC (High Efficiency Image Coding) support, part of the HEIF (High Efficiency Image File) format.
- Breaking change: Resolved an issue with imports where private files are exposed to be imported.
- Individual files can be dragged and dropped on desktop apps and web app on example project.
-
1.2.223 Mar 2025Release notes
Open source →- Updated documentation.
- Updated dependencies from example project.
- Removed cocoapods from example project.
Release notes
Open source →- Updated documentation.
- Updated dependencies from example project.
- Removed cocoapods from example project.
-
1.2.112 Mar 2025 -
1.2.009 Mar 2025Release notes
Open source →- Updated example project dependencies
- Improved tests
- Improved example project flow and style
- Added
getBytesFromPathOrBlobmethod returningUint8Listobject.
-
1.1.119 Feb 2025 -
1.1.019 Feb 2025 -
1.0.019 Feb 2025Release notes
Open source →- BREAKING CHANGE:
MagicNumberhas been renamed toFileMagicNumber. - BREAKING CHANGE:
MagicNumberTypehas been renamed toFileMagicNumberType. - BREAKING CHANGE:
detectFileTypehas been renamed todetectFileTypeFromBytes.
- BREAKING CHANGE:
-
0.8.018 Feb 2025Release notes
Open source →- Simplified CI.
- Improved CD.
- Fixed readme.
- Migrated from Dart to Flutter package.
-
0.7.217 Feb 2025Release notes
Open source →- Improved
MagicNumberMatchTypefor offset and exact detection. - Clearer documentation improvements.
- Improved
-
0.7.117 Feb 2025 -
0.7.016 Feb 2025Release notes
Open source →- Fixed bytes in example project.
- Fixed mp4 were not detected properly.
- Created offset and regular file type detection.
- Added
MagicNumberMatchTypefor offset and exact detection.
-
0.6.016 Feb 2025Release notes
Open source →- Added much more formats.
- Improved documentation.
- Simplified verification.
- Added tests for each format.
- Added debug utilities.
- Very large files are shortened to the first few bytes to speed up the library. This means up to +10x faster on large files.
-
0.5.116 Feb 2025 -
0.5.016 Feb 2025Release notes
Open source →- Added coverage in CI
- Added more test
- Improved readme
- Created as Dart package
-
0.4.016 Feb 2025 -
0.3.115 Feb 2025 -
0.3.015 Feb 2025Release notes
Open source →General
- Refactored structure.
- BREAKING CHANGE:
detectFileTypeuse aUint8Listinstead of aStringas parameter doing it universal.
Web
- Added web development.
-
0.2.015 Feb 2025Release notes
Open source →General
- Example improvements.
- BREAKING CHANGE: Returns
MagicNumberTypewhen detectFileType is called.
-
0.1.015 Feb 2025Release notes
Open source →General
- Added CI.
- Added Example project.
- Added Readme.
- Added documentation.
- Added test.