hfutils.utils.binary

is_binary_file

hfutils.utils.binary.is_binary_file(file) bool[source]

Check if a given file is binary.

This function reads the first 1024 bytes of the file and checks if it contains any non-text (binary) characters.

Parameters:

file (str) – The path to the file to be checked.

Returns:

True if the file is binary, False if it is a text file.

Return type:

bool