Skip to content

naqvis/magic.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

magic.cr

Crystal bindings to libmagic.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      magic:
        github: naqvis/magic.cr
  2. Run shards install

Usage

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)

Contributing

  1. Fork it (https://github.com/naqvis/magic.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors