Magika
File type detection by neural-network model.
This is a Ruby port of Magika, which runs ONNX model of that.
SYNOPSIS
require "magika"
magika = Magika.new
magika.identify_path("path/to/file") # => #<Magika::FileType label=onnx score=0.9998390674591064 application/octet-stream "Open Neural Network Exchange" (archive)>,
require "striongio"
magika.identify_io(StringIO.new("some text content")) # => #<Magika::FileType label=txt score=0.8081967830657959 text/plain "Generic text document" (text)>
INSTALLATION
% gem install magika
Or,
bundle add "magika"
LICENSE
Apache-2.0. See LICENSE file.
Files under vendor/magika is licensed under Apache-2.0 by original Magika's authors.