Setup

First add @bg-dev/nuxt-s3 dependency to your project

NPM
npm install --save-dev @bg-dev/nuxt-s3
Yarn
yarn add --dev @bg-dev/nuxt-s3
PNPM
pnpm install --save-dev @bg-dev/nuxt-s3

Then, add @bg-dev/nuxt-s3 to the modules section of nuxt.config.ts

nuxt.config.ts
export default defineNuxtConfig({
  //
  modules: ["@bg-dev/nuxt-s3"],
  //
});

By default, the modules use fs driver for storage in the filesystem.

nuxt.config.ts
s3: {
    driver: 'fs',
    fsBase: './uploads' // Relative path of the base directory
}

To use S3 driver make sure to set the credentials provided by the service provider.

nuxt.config.ts
s3: {
  driver: 's3',
  bucket: '',
  endpoint: '',
  region: '', // Set to `auto` if not provided
  accessKeyId: '', // Client ID
  secretAccessKey: '', // Client secret
}

This module is tested with Cloudflare R2, Storj, Backblaze and Filebase