Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

binary-extensions

Curated list of file extensions commonly associated with binary files.

The crate ships one immutable list covering archives, images, audio, video, office documents, executables, fonts, RAW camera formats, and similar. Read the BINARY_EXTENSIONS static or call all(). Both give the same &'static [&'static str].

[dependencies]
binary-extensions = "0.1.1"

Use

use binary_extensions::BINARY_EXTENSIONS;

assert!(BINARY_EXTENSIONS.contains(&"png"));
assert!(!BINARY_EXTENSIONS.contains(&"txt"));

Entries are bare lowercase ASCII tokens such as "png", without a leading dot. Strip the dot and lowercase an extension before checking membership, otherwise names like IMAGE.PNG are missed. The one exception is "DS_Store", the macOS Finder metadata file, which keeps its casing and matches as is.

Data shape

The list holds 262 unique ASCII entries in hand-curated order. The order is part of the contract and is stored verbatim. Every entry is lowercase except "DS_Store".

Limits

Classification by extension is a heuristic. A few entries, for example rtf, m3u, and slk, are text-encoded formats kept for compatibility, so a listed extension can still name a file of plain text.

Requirements

The crate is #![no_std], has no dependencies, and is #![forbid(unsafe_code)]. MSRV is 1.56, edition 2021, and the tests run on that release.

License

Licensed under the MIT license.

About

curated list of binary file extensions for text/binary classification

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages