Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lambdalisue/deno-sandbox

🦕 Create a temporary sandbox directory and temporary move into it
https://github.com/lambdalisue/deno-sandbox

deno sandbox temporary

Last synced: 3 months ago
JSON representation

🦕 Create a temporary sandbox directory and temporary move into it

Awesome Lists containing this project

README

        

# sandbox

[![JSR](https://jsr.io/badges/@lambdalisue/sandbox)](https://jsr.io/@lambdalisue/sandbox)
[![Test](https://github.com/lambdalisue/deno-sandbox/actions/workflows/test.yml/badge.svg)](https://github.com/lambdalisue/deno-sandbox/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/lambdalisue/deno-sandbox/graph/badge.svg?token=AEZJlup3Et)](https://codecov.io/gh/lambdalisue/deno-sandbox)

This module provides `sandbox()` and `sandboxSync()` function to create a
temporary sandbox directory and temporary move into it.

## Usage

```ts
import { sandbox, sandboxSync } from "@lambdalisue/sandbox";

{
await using sbox = await sandbox();
// The current working directory is changed to the sandbox directory here.
// Do what ever you want
}
// The current working directory is changed back to the original directory here.

{
using sbox = sandboxSync();
// The current working directory is changed to the sandbox directory here.
// Do what ever you want
}
// The current working directory is changed back to the original directory here.
```

## License

The code follows MIT license written in [LICENSE](./LICENSE). Contributors need
to agree that any modifications sent in this repository follow the license.