Advanced
Overview
Extend Nuxt Upload Kit with custom plugins and storage adapters.
Extending Nuxt Upload Kit
Nuxt Upload Kit is designed to be extensible. You can create custom plugins for validation and file processing, or build your own storage adapters for different cloud providers.
Extension Types
| Type | Purpose | Factory Function |
|---|---|---|
| Processing Plugins | Validate and transform files | defineProcessingPlugin |
| Storage Adapters | Upload to custom storage providers | defineStorageAdapter |
Processing Plugins
Processing plugins hook into the file lifecycle to validate, transform, or enhance files before and after upload.
Common use cases:
- Custom validation rules (filename patterns, content checks)
- Image transformations (watermarks, filters, cropping)
- File format conversions
- Metadata extraction
Learn how to create custom plugins →
Storage Adapters
Storage adapters handle the actual upload, download, and deletion of files from remote storage providers.
Common use cases:
- Custom cloud storage providers
- Self-hosted storage solutions
- Multi-cloud setups
- Custom authentication flows
Learn how to create custom storage adapters →
Plugin Context
Both plugin types receive a context object with access to:
interface PluginContext {
// Current files in the uploader
files: UploadFile[]
// Upload manager options
options: UploadOptions
// Emit custom events (auto-prefixed with plugin ID)
emit: (event: string, payload: any) => void
}
Storage adapters also receive:
interface StorageContext extends PluginContext {
// Report upload progress (0-100)
onProgress: (percentage: number) => void
}
Best Practices
- Use descriptive IDs - Plugin IDs prefix events and errors
- Handle errors gracefully - Return original file if processing fails
- Skip when appropriate - Check file type/source before processing
- Emit progress events - Keep users informed of long operations
- Clean up resources - Revoke object URLs, close connections
- Document options - Use JSDoc for option descriptions

