A fast Golang library for media type and file extension detection, based on magic numbers
Update golang.org/x/net
to latest. Fixes: CVE-2023-45288
Benchmarks:
before:
BenchmarkText/application/x-ndjson-8 663314 2027 ns/op 4306 B/op 6 allocs/op
BenchmarkSliceRand-8 688160 1690 ns/op 728 B/op 75 allocs/op
BenchmarkSrt-8 946042 1089 ns/op 4240 B/op 5 allocs/op
after:
BenchmarkText/application/x-ndjson-8 1930292 678.6 ns/op 160 B/op 4 allocs/op
BenchmarkSliceRand-8 1232066 1173 ns/op 160 B/op 4 allocs/op
BenchmarkSrt-8 3235448 368.8 ns/op 64 B/op 2 allocs/op
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.3...v1.4.4
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.2...v1.4.3
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.1...v1.4.2
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.1...v1.4.2-rc1
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.0...v1.4.1
.png, image/vnd.mozilla.apng .ttc, font/collection .avif, image/avif .srt, application/x-subrip, alias: application/x-srt, text/x-srt .vtt, text/vtt
Full Changelog: https://github.com/gabriel-vasile/mimetype/compare/v1.4.0...v1.4.1-rc1
Features:
Fixes:
Thank you for your contributions @ne1llee, @waybackarchiver, @jonsneyers, @sigma, @anthonyfok, @dennisstritzke, @IevgenLuzan, @Kycklingar.
v1.2.0 introduced a change where error EOF was returned for empty readers.
Previously, text/plain
would be returned for such an input.
v1.3.1 comes back to the pre-v1.2.0 behavior.
Add Extend function. It allows users to detect other file formats not detected by mimetype
. See example for usage.
New supported formats:
Fixes:
Add SetLimit function. It lets users set the length of the header mimetype
reads from the input. Longer headers give better detection results for file formats that keep their magic numbers towards the end of the file.
New supported formats: