Skip to main content
Module

x/sandbox/mod.ts>Sandbox

🦕 Create a temporary sandbox directory which is removed when the instance is disposed
Go to Latest
class Sandbox
implements Disposable
import { Sandbox } from "https://deno.land/x/sandbox@v1.1.0/mod.ts";

Constructors

new
Sandbox(root: string)

Properties

debug: boolean
readonly
root: string

Methods

chmod(path: string, mode: number): Promise<void>
chown(
path: string,
uid: number | null,
gid: number | null,
): Promise<void>
copyFile(fromPath: string, toPath: string): Promise<void>
create(path: string): Promise<Deno.FsFile>
dispose(): void
exists(filePath: string): Promise<boolean>

Test whether or not the given path exists in a sandbox directory by checking with the file system

lstat(path: string): Promise<Deno.FileInfo>
makeTempDir(options?: Omit<Deno.MakeTempOptions, "dir">): Promise<string>
makeTempFile(options?: Omit<Deno.MakeTempOptions, "dir">): Promise<string>
mkdir(path: string, options?: Deno.MkdirOptions): Promise<void>
open(path: string, options?: Deno.OpenOptions): Promise<Deno.FsFile>
readDir(path: string): AsyncIterable<Deno.DirEntry>
readFile(path: string): Promise<Uint8Array>
readTextFile(path: string): Promise<string>
realPath(path: string): Promise<string>
remove(path: string, options?: Deno.RemoveOptions): Promise<void>
rename(oldpath: string, newpath: string): Promise<void>
resolve(...paths: string[]): string

Resolves paths in a sandbox directory to an absolute path

stat(path: string): Promise<Deno.FileInfo>
writeFile(
path: string,
data: Uint8Array,
): Promise<void>
writeTextFile(
path: string,
data: string,
): Promise<void>