GitHub 37
Skip to content
ViteHub is still experimental. Expect bugs and breaking changes.

Blob

Save uploads and other files from your server, then read or serve them on any host.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['vite-hub/nuxt'],
  vitehub: {
    host: 'node',
    // On Node, files are saved in .vitehub/data/blob
    blob: true,
  },
})
nuxt.config.ts
Deploy on

Node / Docker: fs / S3

Save any file

Pass text, bytes, or a stream to blob.put() with a content type and your own metadata.

Uploads in one call

blob.handleUpload() checks file sizes and types before saving anything.

Upload from a Vue page

useUpload() sends the files from an input to your upload route.

Uploads straight to storage

Set direct: true so the browser sends the file to R2, S3, or Vercel Blob, past the host's request size limit.

Large files in parts

Upload a large file in parts. The server joins them at the end.

Copy a file

blob.copy() copies a file with its content type and metadata on the server where the provider supports it.

Links that expire

blob.sign() creates a short-lived URL to read or upload a private file.

Images with alt text, crops, and variants

Media records, folders, ?w=640 variants, and <picture> art direction on every driver.

Many storage services

Use local disk, Cloudflare R2, Vercel Blob, Netlify Blobs, S3, and more, with the same routes.