Nuxt File Storage
Nuxt File Storage is a comprehensive file handling module for Nuxt applications that provides a complete solution for uploading, serializing, and storing files with built-in security features.What is Nuxt File Storage?
Nuxt File Storage bridges the gap between frontend file selection and backend file storage in Nuxt applications. It provides a two-part architecture:- Frontend Composable (
useFileStorage) - Handles file input events and serializes files into a format ready for transmission - Backend Utilities - Provides secure server-side functions to store, retrieve, and manage files with built-in path traversal protection
Key Features
Frontend File Handling
Simple composable for handling file inputs with automatic serialization to base64 data URLs
Secure Backend Storage
Store files in your Nuxt backend with the Nitro engine, with configurable mount points
Path Traversal Protection
Built-in security features prevent directory traversal attacks and ensure files stay within configured boundaries
File Serialization
Automatic conversion between client File objects and server-side data URLs with proper MIME type handling
Streaming Support
Retrieve files as Node.js readable streams for efficient file delivery with proper content headers
TypeScript Support
Full TypeScript support with proper type definitions for ServerFile and ClientFile
Quick Links
Quickstart
Get up and running with a complete example in minutes
Installation
Install and configure the module in your Nuxt project
API Reference
Explore all available functions and composables
How It Works
The module provides a seamless workflow:Automatic Serialization
Files are automatically serialized to base64 data URLs with metadata (name, size, type, lastModified)
Nuxt File Storage handles all the complexity of file serialization, transfer, and storage so you can focus on building your application.
Use Cases
- User avatar uploads
- Document management systems
- Image galleries
- File sharing applications
- Any scenario requiring secure file storage in a Nuxt application