file_magic_number 2.1.0
file_magic_number: ^2.1.0 copied to clipboard
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 #
- 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.0 #
- 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.2 #
- 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.1 #
- 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.0 #
- 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.2 #
- 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.1 #
- Improved file detection.
- Reorganized code and update dependencies.
1.3.0 #
- 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.2 #
- Updated documentation.
- Updated dependencies from example project.
- Removed cocoapods from example project.
1.2.1 #
- Increased support for Dart from version 3.4.
1.2.0 #
- Updated example project dependencies
- Improved tests
- Improved example project flow and style
- Added
getBytesFromPathOrBlobmethod returningUint8Listobject.
1.1.1 #
- Minor improvements.
- Added more documentation.
1.1.0 #
- Added
detectFileTypeFromPathOrBlobmethod. - Improved documentation.
1.0.0 #
- BREAKING CHANGE:
MagicNumberhas been renamed toFileMagicNumber. - BREAKING CHANGE:
MagicNumberTypehas been renamed toFileMagicNumberType. - BREAKING CHANGE:
detectFileTypehas been renamed todetectFileTypeFromBytes.
0.8.0 #
- Simplified CI.
- Improved CD.
- Fixed readme.
- Migrated from Dart to Flutter package.
0.7.2 #
- Improved
MagicNumberMatchTypefor offset and exact detection. - Clearer documentation improvements.
0.7.1 #
- Fixed documentation with
file_pickerdependency.
0.7.0 #
- 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.0 #
- 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.1 #
- Fixed image on pub.dev
0.5.0 #
- Added coverage in CI
- Added more test
- Improved readme
- Created as Dart package