/file_type_detector

detect extensions

Primary LanguageRubyOtherNOASSERTION

FileTypeDetector

Installation

gem 'file_type_detector'

And then execute:

$ bundle

Or install it yourself as:

$ gem install file_type_detector

Usage

Usage:

File Objects

file = File.open('/path/to/file', 'r')
FileTypeDetector::Extension.extension(file)
# => '.jpg'

File Paths

path = '/path/to/file'
FileTypeDetector::Extension.extension(path)
# => '.jpg'

File String

string = File.read('/path/to/file')
FileTypeDetectorTest::Extension.extension(string)
# => '.jpg'

Development

There is plenty to do, this gem currently only supports 'jpg' and 'png'

License

The gem is available as open source under the terms of the People's License

Code of Conduct

Everyone interacting in the FileTypeDetector project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.