Coder Social home page Coder Social logo

aofei / mimesniffer Goto Github PK

View Code? Open in Web Editor NEW
32.0 2.0 1.0 36 KB

A MIME type sniffer for Go.

Home Page: https://pkg.go.dev/github.com/aofei/mimesniffer

License: MIT License

Go 100.00%
mimesniffer mime type content-type file-signature file-format magic-number sniffer go

mimesniffer's People

Contributors

aofei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mimesniffer's Issues

JSON is not recognised

application/json is widely used in REST APIs, but isn't detected by mimesniffer, nor by the default net/http sniffer.

This would be a useful addition for many people.

Correct sniffing should determine whether the content is valid JSON. If it isn't then the result would be "text/plain". This can be done using encoding/json via the json.Valid function.

MP3 MIME is not recognized

What is your user agent?

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0

What did you do?

I used mimesniffer.Sniff with this MP3 file:

Bagdad cafe - I'm Calling you.mp3.zip

buff, err := file.Open()
head := make([]byte, 512)
_, err = buff.Read(head)
contentType = mimesniffer.Sniff(head)

What did you expect to see?

audio/mpeg or audio/mp3

What did you see instead?

application/octet-stream (the MIME type of this file isn't recognized)

Could you add this MIME type to mimesniffer.Sniff?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.