@lambdalisue/sandbox@3.0.1Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
lambdalisue/deno-sandbox🦕 Create a temporary sandbox directory and temporary move into it
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
94%
Published
a week ago (3.0.1)
sandbox
This module provides sandbox() and sandboxSync() function to create a
temporary sandbox directory.
Usage
import { sandbox, sandboxSync } from "@lambdalisue/sandbox"; { await using sbox = await sandbox(); // Create files in the sandbox directory using sbox.resolve() await Deno.writeTextFile(sbox.resolve("foo.txt"), "Hello"); const content = await Deno.readTextFile(sbox.resolve("foo.txt")); } // The sandbox directory is automatically removed here { using sbox = sandboxSync(); // Create files in the sandbox directory using sbox.resolve() Deno.writeTextFileSync(sbox.resolve("bar.txt"), "World"); const content = Deno.readTextFileSync(sbox.resolve("bar.txt")); } // The sandbox directory is automatically removed here
Note: This module does not change the current working directory. This design
allows parallel test execution without interference. Use sbox.resolve(path) to
get absolute paths within the sandbox directory.
License
The code follows MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.
Built and signed on
GitHub Actions
Add Package
deno add jsr:@lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";
Import directly with a jsr specifier
import * as sandbox from "jsr:@lambdalisue/sandbox";
Add Package
pnpm i jsr:@lambdalisue/sandbox
pnpm dlx jsr add @lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";
Add Package
yarn add jsr:@lambdalisue/sandbox
yarn dlx jsr add @lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";
Add Package
vlt install jsr:@lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";
Add Package
npx jsr add @lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";
Add Package
bunx jsr add @lambdalisue/sandbox
Import symbol
import * as sandbox from "@lambdalisue/sandbox";