Assets
Image typed files can be dynamically resized and transformed to fit any need.
Download Files as ZIP
Download multiple files as a ZIP archive.
Request Body
ids
array
File UUIDs to include in the archive.
[string]
string
Responses
ZIP archive of the requested files.
Error: Unauthorized request
error
object
code
integer
message
string
Error: Not found.
error
object
code
integer
message
string
import { createDirectus, rest, downloadFilesZip } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(
downloadFilesZip([
'8cbb43fe-4cdf-4991-8352-c461779cec02',
'b6ac6b72-3c6d-4bd8-9f0f-3e29b6e8b321',
])
);
Download Folder as ZIP
Download a folder's contents as a ZIP archive.
Query Parameters
id
string
Unique identifier of the folder to download.
Responses
ZIP archive of the folder contents.
Error: Unauthorized request
error
object
code
integer
message
string
Error: Not found.
error
object
code
integer
message
string
import { createDirectus, rest, downloadFolderZip } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(
downloadFolderZip('8cbb43fe-4cdf-4991-8352-c461779cec02')
);
Retrieve an Asset
Image typed files can be retrieved, dynamically resized and transformed to fit any need.
Query Parameters
id
string
The id of the file.
key
string
The key of the asset size configured in settings.
transforms
string
A JSON array of image transformations.
download
boolean
Download the asset to your computer
Responses
Successful request
Error: Not found.
error
object
code
integer
message
string
import { createDirectus, rest, readAssetRaw } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readAssetRaw('<file-id>', { key: '<key>' }));