Menu

Simplified file retrieval from Vercel Sandbox environments - Vercel
📰

Simplified file retrieval from Vercel Sandbox environments - Vercel

Vercel News·Laurens Duijvesteijn·6 months ago
#ceURN1uX
#vercel#sandbox#file#stream#generated
Reading 0:00
15s threshold

The Vercel Sandbox SDK now includes two new methods that make file retrieval simple.

When you run code in a Vercel Sandbox , that code can generate files like a CSV report, a processed image, or a PDF invoice. These files are created inside isolated VMs, so they need to be retrieved across a network boundary. Until now, this required manual stream handling with custom piping.

Link to heading Download a file

If you want to download a generated report from your sandbox to your local machine, you can use downloadFile() to seamlessly stream the contents.

const dstPath = await sandbox . downloadFile (

{ path : 'generated-file.csv' , cwd : '/vercel/sandbox' } ,

{ path : 'generated-file.csv' , cwd : '/tmp' }

) ;

Link to heading Read file contents to buffer

Both methods handle the underlying stream operations automatically.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.