Skip to content

A library to guess MIME type from file signature.

Notifications You must be signed in to change notification settings

dpostolachi/magickmime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magickmime

Guess MIME type by file signatures.

Installation

If available in Hex, the package can be installed by adding magickmime to your list of dependencies in mix.exs:

def deps do
  [
    {:magickmime, "~> 0.1.0"}
  ]
end

Example

Works only with BitStrings, a length of 12 bytes should be enough to check all the supported mime types.

{ :ok, file } = File.open( "test/image.png", [ :read ] )
data = IO.binread( file, :all )
Magickmime.mime( data )
"image/png"

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/magickmime.

About

A library to guess MIME type from file signature.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages