Skip to main content

Overview

The Directus SDK provides comprehensive file management capabilities, including uploading files, importing from URLs, retrieving file metadata, and managing file organization.

Read Operations

Read All Files

Retrieve a list of all files:

Read Files with Query

Filter, sort, and paginate files:

Read Single File

Retrieve a specific file by ID:

Upload Operations

Upload Single File

Upload a file using FormData:

Upload with Metadata

Include additional metadata with your file upload:

Import File from URL

Import a file directly from a URL:

Update Operations

Update File Metadata

Update file metadata without re-uploading:

Update Multiple Files

Delete Operations

Delete Single File

Delete Multiple Files

File Properties

The DirectusFile object contains these key properties:

Accessing File URLs

To access the actual file, construct the URL:

Working with Folders

Read Folders

Create Folder

Node.js File Upload Example

Upload files in a Node.js environment:

Type Signatures

Next Steps

Items Operations

Link files to collection items

Users

Manage user avatars and files

Assets API

Transform and optimize images

Storage

Configure file storage adapters