Skip to content

🦕 Create a temporary sandbox directory which is removed when the instance is disposed

License

Notifications You must be signed in to change notification settings

lambdalisue/deno-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sandbox

deno land deno doc Test

This module provides sandbox() function to create a temporary sandbox directory. The Sandbox instance returned by sandbox() has a lot of manipulation methods for files/directories in the temporary directory.

Note that the sandbox instance is Disposable thus uses can use using() function provided by disposable module to ensure that the sandbox temporary directory is cleaned up.

Usage

import { sandbox } from "https://deno.land/x/sandbox/mod.ts";
import { usingResource } from "https://deno.land/x/disposable/mod.ts";

await usingResource(await sandbox(), async (sbox) => {
  // Create a file 'foo' in the sandbox
  const f = await sbox.create("foo");
  // Do what ever you want
});

// The sandbox directory is removed here.

See sandbox_test.ts for examples.

License

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

About

🦕 Create a temporary sandbox directory which is removed when the instance is disposed

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published