Capítulo 172 de 988

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

  1. Understand example when working with uploadToVercelBlob().
  2. Understand arguments when working with uploadToVercelBlob().
  3. Understand sandbox when working with uploadToVercelBlob().
  4. Understand sandboxfilepath when working with uploadToVercelBlob().
  5. 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.