13 releases (1 stable)
| 1.0.0 | Oct 10, 2025 |
|---|---|
| 0.2.2 | Sep 12, 2025 |
| 0.2.1 | Jun 12, 2025 |
| 0.1.1 | Mar 17, 2025 |
| 0.0.0 | Feb 21, 2024 |
#236 in Filesystem
1,910 downloads per month
Used in magika-cli
3MB
3.5K
SLoC
Determines file content types using AI.
Examples
// A Magika session can be used multiple times across multiple threads.
let mut 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");
Magika
This library crate provides file content type detection using AI. 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.
Dependencies
~4.5–9.5MB
~158K SLoC