@vite-hub/blob
v0.0.1
Published
Vite-first blob storage primitives and deployment integration for ViteHub.
Downloads
88
Maintainers
Readme
@vite-hub/blob
@vite-hub/blob gives server code one object-storage API across local files and hosted blob providers.
Install
pnpm add @vite-hub/blobAdd the SDK required by the driver you configure.
Minimal API
// server/api/files.post.ts
import { blob } from "@vite-hub/blob"
import { defineEventHandler, readBody } from "h3"
export default defineEventHandler(async (event) => {
const body = await readBody<{ path: string, text: string }>(event)
await blob.put(body.path, body.text, { contentType: "text/plain" })
return blob.get(body.path)
})// nitro.config.ts
import { defineNitroConfig } from "nitro/config"
export default defineNitroConfig({
modules: ["@vite-hub/blob/nitro"],
blob: {
driver: "fs",
base: ".data/blob",
},
})Vite and Nitro
Use hubBlob() in Vite or @vite-hub/blob/nitro in Nitro. Both resolve the same blob config and expose the same blob runtime helper.
Core drivers include local fs, Vercel Blob, Cloudflare R2, S3-compatible stores, and files-sdk.
Learn more at vitehub.dev.
