3 unstable releases

0.1.0-rc.1 Sep 26, 2024
0.1.0-rc.0 Sep 12, 2024
0.0.0 Feb 21, 2024

#221 in Filesystem

Download history 5/week @ 2024-07-27 81/week @ 2024-09-07 44/week @ 2024-09-14 104/week @ 2024-09-21 45/week @ 2024-09-28 5/week @ 2024-10-05 26/week @ 2024-10-12 5/week @ 2024-10-19

106 downloads per month

Apache-2.0

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–11MB
~128K SLoC