uploadToVercelBlob()v4.0.426
Experimental package: We reserve the right to make breaking changes in order to correct bad design decisions until this notice is gone.
Uploads a file from the sandbox to Vercel Blob storage. Typically used after renderMediaOnVercel() or renderStillOnVercel() to make the output publicly accessible.
Example
route.tsconst {url ,size } = awaituploadToVercelBlob ({sandbox ,sandboxFilePath : '/tmp/video.mp4',contentType : 'video/mp4',blobToken :process .env .BLOB_READ_WRITE_TOKEN !,access : 'public', });console .log (`Uploaded ${size } bytes to ${url }`);
Arguments
An object with the following properties:
sandbox
A Sandbox instance.
sandboxFilePath
The path to the file inside the sandbox to upload, e.g. "/tmp/video.mp4".
blobPath?
The destination path in Vercel Blob, e.g. "renders/abc.mp4". If omitted, a random path is generated.
contentType
The MIME type of the file, e.g. "video/mp4" or "image/png".
blobToken
Your Vercel Blob read/write token. Typically process.env.BLOB_READ_WRITE_TOKEN.
access
VercelBlobAccess
The access level of the uploaded blob. Either "public" or "private". Default: "private".
Return value
An object containing:
url
The public download URL of the uploaded file.
size
The size of the uploaded file in bytes.