from typing import Union
from pathlib import Path


def is_binary(path: Union[Path, str]) -> bool:
    """Return true if the given filename is binary.

    Args:
        path (pathlib.Path): File to check

    Returns:
        bool: True if file appears to be binary, False otherwise
    """
    if isinstance(path, str):
        path = Path(path)
    with path.open("rb") as f:
        chunk = f.read(8000)
        if b"\0" in chunk:
            return True

    return False