Download Bytes

async AsyncCogniteClient.files.download_bytes(
id: int | None = None,
external_id: str | None = None,
instance_id: NodeId | None = None,
) bytes

Download a file as bytes.

Parameters:
  • id (int | None) – Id of the file

  • external_id (str | None) – External id of the file

  • instance_id (NodeId | None) – Instance id of the file

Examples

Download a file’s content into memory:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> file_content = client.files.download_bytes(id=1)
Returns:

The file in binary format

Return type:

bytes