4 releases

new 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

#240 in Filesystem

Download history 2/week @ 2024-07-31 118/week @ 2024-09-11 20/week @ 2024-09-18 125/week @ 2024-09-25 13/week @ 2024-10-02 23/week @ 2024-10-09 11/week @ 2024-10-16 4/week @ 2024-10-30 56/week @ 2024-11-06 180/week @ 2024-11-13

243 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–12MB
~132K SLoC