@vercel/blob
Globally distributed file storage with a 3-line API — no S3 buckets, IAM policies, or config required.
@vercel/blob
Node.jsGlobally distributed file storage with a 3-line API — no S3 buckets, IAM policies, or config required.
Fit
Bundle (gzip)
29.5 kB
109.4 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Storing user-uploaded files (images, PDFs, attachments) in a Node.js app typically means:
- Setting up an AWS S3 bucket with IAM roles, CORS policies, and bucket policies
- Managing pre-signed URLs for secure uploads
- Configuring a CDN separately for fast delivery
- Handling multipart uploads for large files
- Remembering which env vars map to which credentials across environments
It's a lot of infrastructure for what is conceptually a simple operation: store a file, get a URL back.
What It Does
@vercel/blob gives you a simple API to upload, list, and delete files. Files are stored on Vercel's globally distributed edge network — no CDN setup needed, files are served fast everywhere. Works from both server-side Node.js code and client-side browser uploads.
Installation
npm install @vercel/blobUsage Example
Upload a file (server-side)
import { put } from "@vercel/blob";
export async function POST(request: Request) {
const form = await request.formData();
const file = form.get("file") as File;
const blob = await put(file.name, file, {
access: "public",
});
return Response.json({ url: blob.url });
// blob.url is a globally distributed CDN URL — ready to use immediately
}Client-side upload (bypass your server)
"use client";
import { upload } from "@vercel/blob/client";
export function AvatarUpload() {
async function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
const file = e.target.files?.[0];
if (!file) return;
const blob = await upload(file.name, file, {
access: "public",
handleUploadUrl: "/api/avatar/upload", // your server-side token endpoint
});
console.log("Uploaded:", blob.url);
}
return <input type="file" onChange={handleChange} />;
}List and delete files
import { list, del } from "@vercel/blob";
// List all blobs
const { blobs } = await list({ prefix: "avatars/" });
// Delete a blob
await del("https://your-blob-url.vercel-storage.com/avatar.png");Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.