Chapter 167: createSandbox()
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
- onProgress?
- resources?
- timeoutInMilliseconds?<AvailableFrom v="4.0.452" />
- Return value
- Stopping the sandbox
- Using sandbox.stop()
Code Examples
// @module: es2022
// @target: es2022
const sandbox = await createSandbox({
onProgress: async ({progress, message}) => {
console.log(`${message} (${Math.round(progress * 100)}%)`);
},
});
await addBundleToSandbox({
sandbox,
bundleDir: '/path/to/bundle',
});
// ... use the sandbox
await sandbox.stop();
- What it demonstrates: Usage pattern for createSandbox() from the official docs.
Key Takeaways
- Understand example when working with createSandbox().
- Understand arguments when working with createSandbox().
- Understand onprogress? when working with createSandbox().
- Understand resources? when working with createSandbox().
- Understand timeoutinmilliseconds?<availablefrom v="4.0.452" /> when working with createSandbox().
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.