def _get_file_mimetype(filedata: bytes) -> str:
    """
    Gets the mimetype of a file based on file signature.

    Args:
        filedata: The file data to process.

    Returns:
        The mimetype of the file.

    """
    if filedata.startswith((b"GIF87a", b"GIF89a")):
        return "image/gif"
    elif filedata.startswith(b"\x89PNG\x0D\x0A\x1A\x0A"):
        return "image/png"
    elif filedata.startswith(b"\xff\xd8\xff"):
        return "image/jpeg"
    elif filedata[0:4] == b"RIFF" and filedata[8:12] == b"WEBP":
        return "image/webp"
    else:
        return "application/octet-stream"