Upload a file content
- async AsyncCogniteClient.files.upload_content(
- path: Path | str,
- external_id: str | None = None,
- instance_id: NodeId | tuple[str, str] | None = None,
-
Upload file content from a local file path to a file previously created (initiated) with only metadata. For files created with FilesAPI.create(), use external_id. For files created with data modeling API using CogniteFileApply, use instance_id. Supports upload of large files (>5 GiB), using multipart upload.
- Parameters:
path (Path | str) – Local file path.
external_id (str | None) – The external ID provided by the client. Must be unique within the project.
instance_id (NodeId | tuple[str, str] | None) – Instance ID of the file (CogniteFile).
- Returns:
No description.
- Return type:
Examples
Upload file content using instance_id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> from cognite.client.data_classes.data_modeling import NodeId >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.files.upload_content( ... "/path/to/file.txt", instance_id=NodeId("my-space", "my-file-xid") ... )