Chapter 172: uploadToVercelBlob()
Core Idea
:::warning Experimental package: We reserve the right to make breaking changes in order to correct bad design decisions until this notice is gone.
Key Concepts
- Example
- Arguments
- sandbox
- sandboxFilePath
- blobPath?
- contentType
- blobToken
- access
Code Examples
// @module: es2022
// @target: es2022
const sandbox = await createSandbox();
await addBundleToSandbox({sandbox, bundleDir: '/path/to/bundle'});
const {url, size} = await uploadToVercelBlob({
sandbox,
sandboxFilePath: '/tmp/video.mp4',
contentType: 'video/mp4',
blobToken: process.env.BLOB_READ_WRITE_TOKEN!,
access: 'public',
});
console.log(`Uploaded ${size} bytes to ${url}`);
- What it demonstrates: Usage pattern for uploadToVercelBlob() from the official docs.
Key Takeaways
- Understand example when working with uploadToVercelBlob().
- Understand arguments when working with uploadToVercelBlob().
- Understand sandbox when working with uploadToVercelBlob().
- Understand sandboxfilepath when working with uploadToVercelBlob().
- Understand blobpath? when working with uploadToVercelBlob().
Connects To
- Azure Container Apps: related page in the Deployment & Runtimes section.
- bun: related page in the Deployment & Runtimes section.
- Cloudflare Containers: related page in the Deployment & Runtimes section.