Installation
Get started with Nuxt File Storage by installing the module and configuring your storage location.Install the Module
Addnuxt-file-storage as a dependency to your Nuxt project using your preferred package manager:
Register the Module
Addnuxt-file-storage to the modules section of your nuxt.config.ts:
nuxt.config.ts
Configuration
You can configure the storage mount point where files will be saved. This is the absolute path to the directory where uploaded files will be stored.Basic Configuration
Add thefileStorage configuration to your nuxt.config.ts:
nuxt.config.ts
Using Environment Variables (Recommended)
For better security and flexibility across different environments, use environment variables:nuxt.config.ts
.env file in your project root:
.env
Configuration Options
The absolute path to the directory where files will be stored. This directory will be created automatically if it doesn’t exist.Example:
/home/user/my-app/server/filesVerify Installation
After installation, when you start your Nuxt development server, you should see a confirmation message:TypeScript Support
The module automatically provides TypeScript type definitions. You’ll have full autocomplete and type checking for:useFileStorage()composableServerFileandClientFiletypes- Backend utility functions (
storeFileLocally,getFileLocally, etc.)