interface DenoHost

Minimal interface covering the Deno-specific operations used by this adapter. Inject this interface to test the adapter without real Deno.

Properties

version: { deno: string; }

Current runtime version string.

env: { toObject(): Record<string, string>; }

Environment variable map.

build: { os: string; }

Build metadata. Read for os alone, to decide whether signal listening is available — see createDenoRuntimeServices.

Methods

hostname(): string

Returns the host name.

exit(code?: number): never

Exit the process.

addSignalListener(
signal: RuntimeSignal,
handler: () => void
): void

Registers a signal listener.

Throws on Windows, which is why the adapter guards on DenoHost.build rather than calling this unconditionally.

readFile(path: string): Promise<Uint8Array>

Read file as bytes.

realPath(path: string): Promise<string>

Resolve a path to its canonical absolute form, following symlinks.

writeFile(
path: string,
): Promise<void>

Write bytes to a file.

stat(path: string): Promise<DenoFileInfo>

Get file/directory info.

readDir(path: string): AsyncIterable<DenoDirEntry>

Lists directory entries. Named and shaped after the real API this host defaults to: Deno.readDir (capital D) returns an async iterable, so it must be consumed with for await.

mkdir(
path: string,
options?: { recursive?: boolean; }
): Promise<void>

Create a directory.

remove(
path: string,
options?: { recursive?: boolean; }
): Promise<void>

Remove a file or directory.

resolveDns(
query: string,
recordType: "SRV"
): Promise<DenoSrvRecord[]>

Resolves SRV records.

resolveDns(
query: string,
recordType: "A" | "AAAA"
): Promise<string[]>

Resolves address records.

open(path: string): Promise<Deno.FsFile>

Open a file for reading.