Created
May 31, 2012 04:25
-
-
Save cmthakur/2841029 to your computer and use it in GitHub Desktop.
Extract the file type in ruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can simply find the file type of a file where file.content_type doesnot works | |
options[:form] = "./lib/cf/cli/templates/sample-line/form.html" | |
file_type = IO.popen(["file", "--brief", "--mime-type", options[:form]], in: :close, err: :close).read.chomp | |
The return type is simply "text/html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment