Crystal bindings to libmagic
.
-
Add the dependency to your
shard.yml
:dependencies: magic: github: naqvis/magic.cr
-
Run
shards install
require "magic"
# File Name
puts Magic.detect("README.md")
# File object
File.open("README.md") do |file|
puts Magic.detect(file)
end
# Contents
puts Magic.detect(File.read("README.md").to_slice)
- Fork it (https://github.com/naqvis/magic.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Ali Naqvi - creator and maintainer