Skip to content
Dashboard

Filesystem snapshots supported on Vercel Sandboxes

Link to headingHow snapshots work

Link to headingKey capabilities

import { Sandbox } from '@vercel/sandbox';
const sandbox = await Sandbox.create();
await sandbox.writeFiles([{
path: '/vercel/sandbox/hello',
content: Buffer.from('Hello Vercel Sandbox and Snapshots'),
}]);
const snapshot = await sandbox.snapshot();
const newSandbox = await Sandbox.create({
source: { type: 'snapshot', snapshotId: snapshot.snapshotId },
});
for await (const chunk of await newSandbox.readFile({ path: '/vercel/sandbox/hello' })) {
process.stdout.write(chunk);
};