libgit2

git_blob_is_binary

Version:

Determine if the blob content is most certainly binary or not.

The heuristic used to guess if a file is binary is taken from core git: Searching for NUL bytes and looking for a reasonable ratio of printable to non-printable characters among the first 8000 bytes.

Signature

int git_blob_is_binary(const git_blob *blob);

Parameters

In
blob

The blob which content should be analyzed

Returns

int

1 if the content of the blob is detected as binary; 0 otherwise.

Versions