1 个稳定版本

1.0.0 2019年6月11日

#1000文件系统

Download history • Rust 包仓库 646/week @ 2024-03-14 • Rust 包仓库 702/week @ 2024-03-21 • Rust 包仓库 632/week @ 2024-03-28 • Rust 包仓库 563/week @ 2024-04-04 • Rust 包仓库 639/week @ 2024-04-11 • Rust 包仓库 549/week @ 2024-04-18 • Rust 包仓库 939/week @ 2024-04-25 • Rust 包仓库 605/week @ 2024-05-02 • Rust 包仓库 547/week @ 2024-05-09 • Rust 包仓库 424/week @ 2024-05-16 • Rust 包仓库 504/week @ 2024-05-23 • Rust 包仓库 514/week @ 2024-05-30 • Rust 包仓库 528/week @ 2024-06-06 • Rust 包仓库 370/week @ 2024-06-13 • Rust 包仓库 437/week @ 2024-06-20 • Rust 包仓库 350/week @ 2024-06-27 • Rust 包仓库

1,771 每月下载量

MIT/ApacheLGPL-3.0

280KB
71

包含 (Mach-o 可执行文件, 30KB) tests/isBinaryFile/grep, (WOFF 字体, 19KB) glyphiconshalflings-regular.woff

binaryornot

Build Status

binaryornot 的 Rust 版本,让您检测文件是否为二进制文件或文本文件。

用法

将以下内容添加到您的 cargo.toml

[dependencies]
binaryornot = "1.0"
use binaryornot;

if binaryornot::is_binary("/path/to/some/file").expect("unable to read file") {
    println!("a binary!");
}

限制

由于依赖于 encoding crate 来检测不同的文本编码,UTF-32 不会像原始的 Python binaryornot 实现那样正确地被检测为文本。

许可证

如 cargo.toml 中所示,此库可以在 MIT 或 Apache 2.0 许可证下使用。但是,应该注意的是,其依赖之一 chardet 在 LGPL 许可下发布,这意味着任何静态链接到它的程序也必须在 LGPL 许可下分发。

依赖项

~4MB
~43K SLoC