mimetype
mimetype copied to clipboard
A fast Golang library for media type and file extension detection, based on magic numbers
Added in API of this repository an opportunity to check whether content matches a specific MIME type. For example this is could be used to detect that file isn't malformed...
I tested library using 64 presentation but 5/64 presentations were detected as zip archive. After increasing ReadLimit (i set 30720 instead 3720), all presentations were detected as pptx. I would...
[audio/mp4](https://filebin.net/zao81tamdngs06ub/UogDqpbPq6Vt88P7HMNYVK.m4a?t=wtnwbiyb) **Expected mime type** audio/mp4 **Returned mime type** video/mp4 **Version of the library you are using** 1.1 **Output of `go version`** go version go1.14 darwin/amd64 **Additional context** The code assumes...
Added support for binary and ascii-armored pgp-encrypted files.
If we use `matchers.ReadLimit` then the test fails with `use of internal package github.com/gabriel-vasile/mimetype/internal/matchers not allowed`. `matchers.ReadLimit` is needed to implement a custom readers.
Add a helper function for getting `MIME` from extension [similar to this](https://golang.org/pkg/mime/#TypeByExtension)
file:"d771f1704e142f84dde1fa59dd8ef6a6.pdf" ` mime,_ := mimetype.DetectReader(finalFile) //text/plain; charset=utf-8 mime, _ := mimetype.DetectFile("xxx/xxx/d771f1704e142f84dde1fa59dd8ef6a6.pdf")//application/pdf `
Is it possible to wrap this library in Python for ease of usage?
1) Specify the MIME type and extension for which to add support `application/x-yaml` or `text/yaml` 2) Share an example file https://github.com/kubernetes-sigs/kustomize/blob/master/examples/helloWorld/configMap.yaml 3) Optionally, add a reference to the specification of...
Resources: - https://golang.org/doc/go1.14#mime - https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/?include_text=1