def METHOD_NAME(
    pack: Union[ResourcePack, DataPack],
    binary_files: bool = False,
) -> JsonDict:
    listing: JsonDict = {
        "name": pack.name,
        "description": pack.description,
        "pack_format": pack.pack_format,
        "empty": not pack,
    }
    listing["text_files"] = {
        k: v.text for k, v in pack.list_files(extend=TextFileBase[Any])
    }
    if binary_files:
        listing["binary_files"] = {
            k: base64.b64encode(v.blob).decode()
            for k, v in pack.list_files(extend=BinaryFileBase[Any])
        }
    return listing