Rest...args: [string, CDFHttpClient, MetadataMap]Asset-centric file metadata, deprecated 2026-10-15 and retired 2027-12-31. Create and query files as CogniteFile instances via client.instances instead. Will be removed in a future major release. See https://docs.cognite.com/cdf/deprecated and https://github.com/cognitedata/cognite-sdk-js/blob/master/guides/DEPRECATIONS.md#files-asset-centric-metadata-and-filters.
await client.files.delete([{id: 123}, {externalId: 'abc'}]);
Asset-centric file metadata, deprecated 2026-10-15 and retired 2027-12-31. Delete the CogniteFile instance via client.instances.delete instead. Will be removed in a future major release. See https://docs.cognite.com/cdf/deprecated and https://github.com/cognitedata/cognite-sdk-js/blob/master/guides/DEPRECATIONS.md#files-asset-centric-metadata-and-filters.
Get download urls File content download stays on the Files API; prefer instanceId.
await client.files.getDownloadUrls([
{ instanceId: { space: 'my-space', externalId: 'my-file' } },
]);
const files = await client.files.list({filter: {mimeType: 'image/png'}});
Optionalscope: FileRequestFilter// Each file part must be larger than 5 MiB, and smaller than 4000 MiB. The file part for the last uploadURL can be smaller than 5 MiB.
const numberOfParts = 5;
// automatic upload:
const multiPartUploadApi = await client.files.multipartUploadSession({name: 'examplefile.jpg', mimeType: 'image/jpeg'}, numberOfParts);
const files = await client.files.retrieve([{id: 123}, {externalId: 'abc'}]);
Asset-centric file metadata, deprecated 2026-10-15 and retired 2027-12-31. Retrieve files as CogniteFile instances via client.instances instead, and get download URLs with getDownloadUrls by instanceId. Will be removed in a future major release. See https://docs.cognite.com/cdf/deprecated and https://github.com/cognitedata/cognite-sdk-js/blob/master/guides/DEPRECATIONS.md#files-asset-centric-metadata-and-filters.
const files = await client.files.search({
filter: {
mimeType: 'image/jpeg',
},
search: {
name: 'Pump'
}
});
Asset-centric file metadata, deprecated 2026-10-15 and retired 2027-12-31. Create and query files as CogniteFile instances via client.instances instead. Will be removed in a future major release. See https://docs.cognite.com/cdf/deprecated and https://github.com/cognitedata/cognite-sdk-js/blob/master/guides/DEPRECATIONS.md#files-asset-centric-metadata-and-filters.
const files = await client.files.update([{
id: 123,
update: {
source: { set: 'new source' }
}
}]);
Asset-centric file metadata, deprecated 2026-10-15 and retired 2027-12-31. Create and query files as CogniteFile instances via client.instances instead. Will be removed in a future major release. See https://docs.cognite.com/cdf/deprecated and https://github.com/cognitedata/cognite-sdk-js/blob/master/guides/DEPRECATIONS.md#files-asset-centric-metadata-and-filters.
const fileContent = 'file data here'; // can also be of type ArrayBuffer, Buffer, Blob, File or any
// automatic upload:
const file = await client.files.upload({name: 'examplefile.jpg', mimeType: 'image/jpeg'}, fileContent);
// manual with uploadUrl:
const file2 = await client.files.upload({name: 'examplefile.jpg', mimeType: 'image/jpeg'});
// then upload using the file.uploadUrl
OptionalfileContent: unknown
Aggregate files