4 releases
0.1.0-rc.2 | Nov 19, 2024 |
---|---|
0.1.0-rc.1 | Sep 26, 2024 |
0.1.0-rc.0 | Sep 12, 2024 |
0.0.0 | Feb 21, 2024 |
#244 in Filesystem
633 downloads per month
3MB
3.5K
SLoC
Magika
This library crate provides file type detection with deep-learning. A command-line interface (CLI) for this library is provided by the magika-cli binary crate.
Disclaimer
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.
This magika
library and the magika-cli
binary are still unstable (as indicated by the major
version of zero) and new versions might introduce breaking changes (all changes will follow cargo
semver compatibility). In particular,
version 0.1.0-rc.0 ships a new model in comparison to the Python binary and we would love feedback
on GitHub.
lib.rs
:
Determines the type of a file with deep-learning.
Examples
// A Magika session can be used multiple times across multiple threads.
let magika = magika::Session::new()?;
// Files can be identified from their path.
assert_eq!(magika.identify_file_sync("src/lib.rs")?.info().label, "rust");
// Contents can also be identified directly from memory.
let result = magika.identify_content_sync(&b"#!/bin/sh\necho hello"[..])?;
assert_eq!(result.info().label, "shell");
Dependencies
~5–12MB
~133K SLoC