const files = await client.files.list({filter: {mimeType: 'image/png'}});
// 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'}]);
const files = await client.files.search({
filter: {
mimeType: 'image/jpeg',
},
search: {
name: 'Pump'
}
});
const files = await client.files.update([{
id: 123,
update: {
source: { set: 'new source' }
}
}]);
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
Aggregate files
const aggregates = await client.files.aggregate({ filter: { uploaded: true } }); console.log('Number of uploaded files: ', aggregates[0].count)