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

#245 in Filesystem

Download history 58/week @ 2024-09-06 65/week @ 2024-09-13 81/week @ 2024-09-20 66/week @ 2024-09-27 8/week @ 2024-10-04 27/week @ 2024-10-11 5/week @ 2024-10-18 24/week @ 2024-11-01 91/week @ 2024-11-08 211/week @ 2024-11-15 191/week @ 2024-11-22 116/week @ 2024-11-29

625 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
~134K SLoC