sandbox

JSR Test codecov

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

Usage

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. Contributors need to agree that any modifications sent in this repository follow the license.