Crate magika

Crate magika 

Source
Expand description

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");

Structs§

Builder
Configures and creates a Magika session.
Features
Features to identify a file using AI.
InferredType
Content type identified using AI.
Session
A Magika session to identify files.
TypeInfo
File type information.

Enums§

ContentType
Content types for regular files.
Error
Errors returned by Magika functions.
FeaturesOrRuled
Result of features extraction.
FileType
File types.
OverwriteReason
Reason to overwrite an inferred content type.

Constants§

MODEL_MAJOR_VERSION
Model major version.
MODEL_NAME
Model name (only comparable with equality).

Traits§

AsyncInput
Asynchronous abstraction over file content.
SyncInput
Synchronous abstraction over file content.

Type Aliases§

Result
Result type of Magika functions.