The Local storage driver stores files on the server’s file system. This is the simplest storage option and is suitable for development, testing, or single-server deployments.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/directus/directus/llms.txt
Use this file to discover all available pages before exploring further.
Installation
The Local driver is included by default with Directus via the@directus/storage-driver-local package.
Configuration
Configure Local storage using environment variables:Configuration Options
The root directory where files will be stored. Can be absolute or relative to the Directus installation directory.
Examples
Basic Configuration
Absolute Path
Multiple Local Locations
You can configure multiple local storage locations for different purposes:Features
Resumable Uploads
The Local driver supports TUS resumable uploads with the following extensions:creation- Create new uploadstermination- Cancel/delete uploadsexpiration- Automatic cleanup of incomplete uploads
Range Requests
The Local driver supports HTTP range requests for efficient partial file reading:Implementation Details
The Local driver (DriverLocal class) from /packages/storage-driver-local/src/index.ts:14-174:
- Uses Node.js file system APIs (
fs/promises) - Automatically creates directories as needed
- Supports both relative and absolute paths
- All paths are resolved relative to the configured
root - Uses streams for efficient memory usage with large files
Best Practices
Directory Permissions
Ensure the Directus process has read/write permissions for the configured root directory:Backups
Regularly backup your upload directory:Production Considerations
For production deployments:- Use absolute paths for clarity
- Store files outside the Directus installation directory
- Consider using cloud storage for scalability
- Implement proper backup strategies
- Monitor disk space usage
Multi-Server Deployments
Local storage is not recommended for multi-server deployments because:- Files are only available on one server
- No automatic synchronization between servers
- Load balancers may route requests to servers without the file
Troubleshooting
Permission Errors
If you encounter permission errors:- Check directory ownership:
ls -la ./uploads - Verify the Directus process user has write access
- Check SELinux or AppArmor policies if applicable