Crate content_inspector [] [src]

A simple library for fast inspection of binary buffers to guess/determine the type of content.

This is mainly intended to quickly determine whether a given buffer contains "binary" or "text" data. The analysis is based on a very simple heuristic: Detection of special byte order marks and searching for NULL bytes. Note that this analysis can fail. For example, even if unlikely, UTF-8-encoded text can legally contain NULL bytes. Also, for performance reasons, only the first 1024 bytes are checked for the NULL-byte (if no BOM) is detected.

Enums

ContentType

The type of encoding that was detected (for "text" data) or BINARY for "binary" data.

Functions

inspect

Try to determine (or rather: guess) the type of content in the given buffer. See the documentation of the crate for more information about how the analysis is done.