file_validators icon indicating copy to clipboard operation
file_validators copied to clipboard

use mimemagic to determine content type by content

Open Fivell opened this issue 9 years ago • 5 comments

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?

Fivell avatar Jan 22 '16 18:01 Fivell

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 avatar Jan 22 '16 18:01 musaffa

@musaffa , I need secure detecting of mime type , but I don't want to use command line for this.

Fivell avatar Jan 22 '16 18:01 Fivell

file is a mature Unix program.

musaffa avatar Jan 22 '16 18:01 musaffa

@Fivell After the cleanup, file integration will be removed.

musaffa avatar Jan 22 '16 19:01 musaffa

@musaffa , :+1:

Fivell avatar Jan 22 '16 19:01 Fivell