file_validators
file_validators copied to clipboard
use mimemagic to determine content type by content
Hello, there is note in mimemagic gem README.
MimeMagic is a library to detect the mime type of a file by extension or by content
.
MimeMagic.by_magic(File.open('test.html'))
So in what cases should I use cocaine
? When mimemagic
is not enough?
Mime magic gem has been added with a recent PR #7 . It's currently in the master and needs a lot of clean up before being pushed as a new gem. Please use stable version 2.0.2.
@musaffa , I need secure detecting of mime type , but I don't want to use command line for this.
file is a mature Unix program.
@Fivell After the cleanup, file
integration will be removed.
@musaffa , :+1: