Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

Addr

Addr: string

BlobPart

BlobPart: BufferSource | Blob | string

BodyInit

BufferSource

BufferSource: ArrayBufferView | ArrayBuffer

ConsoleOptions

ConsoleOptions: Partial<object>

Constructor

Constructor: object

Type declaration

EndingType

EndingType: "transparent" | "native"

EventListenerOrEventListenerObject

EventListenerOrEventListenerObject: EventListener | EventListenerObject

FormDataEntryValue

FormDataEntryValue: DomFile | string

HeadersInit

HeadersInit: Headers | Array<[string, string]> | Record<string, string>

MessageCallback

MessageCallback: function

Type declaration

    • (msg: Uint8Array): void
    • Parameters

      • msg: Uint8Array

      Returns void

Network

Network: "tcp"

OpenMode

OpenMode: "r" | "r+" | "w" | "w+" | "a" | "a+" | "x" | "x+"

PrintFunc

PrintFunc: function

Type declaration

    • (x: string, isErr?: boolean, printsNewline?: boolean): void
    • Parameters

      • x: string
      • Optional isErr: boolean
      • Optional printsNewline: boolean

      Returns void

ProcessStdio

ProcessStdio: "inherit" | "piped" | "null"

How to handle subsubprocess stdio.

"inherit" The default if unspecified. The child inherits from the corresponding parent descriptor.

"piped" A new pipe should be arranged to connect the parent and child subprocesses.

"null" This stream will be ignored. This is the equivalent of attaching the stream to /dev/null.

PromiseRejectEvent

PromiseRejectEvent: "RejectWithNoHandler" | "HandlerAddedAfterReject" | "ResolveAfterResolved" | "RejectAfterResolved"

ReferrerPolicy

ReferrerPolicy: "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"

RequestCache

RequestCache: "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached"

RequestCredentials

RequestCredentials: "omit" | "same-origin" | "include"

RequestDestination

RequestDestination: "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt"

RequestInfo

RequestInfo: Request | string

RequestMode

RequestMode: "navigate" | "same-origin" | "no-cors" | "cors"

RequestRedirect

RequestRedirect: "follow" | "error" | "manual"

ResourceMap

ResourceMap: object

Type declaration

  • [rid: number]: string

ResponseType

ResponseType: "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"

TypedArray

TypedArray: Uint8Array | Float32Array | Int32Array

URLSearchParamsInit

URLSearchParamsInit: string | string[][] | Record<string, string>

Variables

Const args

args: string[]

Const libdeno

libdeno: Libdeno

Let pid

pid: number

process id

Const platform

platform: Platform

Const stderr

stderr: File

An instance of File for stderr.

Const stdin

stdin: File

An instance of File for stdin.

Const stdout

stdout: File

An instance of File for stdout.

Functions

DomIterableMixin

  • Mixes in a DOM iterable methods into a base class, assumes that there is a private data iterable that is part of the base class, located at [dataSymbol]. TODO Don't expose DomIterableMixin from "deno" namespace.

    Type parameters

    Parameters

    • Base: TBase
    • dataSymbol: symbol

    Returns TBase & Constructor<DomIterable<K, V>>

chdir

  • chdir(directory: string): void
  • chdir() Change the current working directory to path. throws NotFound exception if directory not available

    Parameters

    • directory: string

    Returns void

chmod

  • chmod(path: string, mode: number): Promise<void>
  • Changes the permission of a specific file/directory of specified path.

      import { chmod } from "deno";
      await chmod("/path/to/file", 0o666);

    Parameters

    • path: string
    • mode: number

    Returns Promise<void>

chmodSync

  • chmodSync(path: string, mode: number): void
  • Changes the permission of a specific file/directory of specified path synchronously.

      import { chmodSync } from "deno";
      chmodSync("/path/to/file", 0o666);

    Parameters

    • path: string
    • mode: number

    Returns void

close

  • close(rid: number): void
  • Close the file ID.

    Parameters

    • rid: number

    Returns void

connect

  • connect(network: Network, address: string): Promise<Conn>
  • RESERVED*

    Parameters

    Returns Promise<Conn>

copy

  • Copies from src to dst until either EOF is reached on src or an error occurs. It returns the number of bytes copied and the first error encountered while copying, if any.

    Because copy() is defined to read from src until EOF, it does not treat an EOF from read() as an error to be reported.

    Parameters

    Returns Promise<number>

copyFile

  • copyFile(from: string, to: string): Promise<void>
  • Copies the contents of a file to another by name.

    Creates a new file if target does not exists, and if target exists, overwrites original content of the target file.

    It would also copy the permission of the original file to the destination.

      import { copyFile } from "deno";
      await copyFile("from.txt", "to.txt");

    Parameters

    • from: string
    • to: string

    Returns Promise<void>

copyFileSync

  • copyFileSync(from: string, to: string): void
  • Copies the contents of a file to another by name synchronously. Creates a new file if target does not exists, and if target exists, overwrites original content of the target file.

    It would also copy the permission of the original file to the destination.

      import { copyFileSync } from "deno";
      copyFileSync("from.txt", "to.txt");

    Parameters

    • from: string
    • to: string

    Returns void

create

  • create(filename: string): Promise<File>
  • A factory function for creating instances of File associated with the supplied file name.

    Parameters

    • filename: string

    Returns Promise<File>

cwd

  • cwd(): string
  • cwd() Return a string representing the current working directory. If the current directory can be reached via multiple paths (due to symbolic links), cwd() may return any one of them. throws NotFound exception if directory not available

    Returns string

deferred

  • Create a wrapper around a promise that could be resolved externally. TODO Do not expose this from "deno" namespace.

    Returns Deferred

dial

  • dial(network: Network, address: string): Promise<Conn>
  • Dial connects to the address on the named network.

    Supported networks are only tcp currently.

    TODO: tcp4 (IPv4-only), tcp6 (IPv6-only), udp, udp4 (IPv4-only), udp6 (IPv6-only), ip, ip4 (IPv4-only), ip6 (IPv6-only), unix, unixgram and unixpacket.

    For TCP and UDP networks, the address has the form host:port. The host must be a literal IP address, or a host name that can be resolved to IP addresses. The port must be a literal port number or a service name. If the host is a literal IPv6 address it must be enclosed in square brackets, as in [2001:db8::1]:80 or [fe80::1%zone]:80. The zone specifies the scope of the literal IPv6 address as defined in RFC 4007. The functions JoinHostPort and SplitHostPort manipulate a pair of host and port in this form. When using TCP, and the host resolves to multiple IP addresses, Dial will try each IP address in order until one succeeds.

    Examples:

    dial("tcp", "golang.org:http")
    dial("tcp", "192.0.2.1:http")
    dial("tcp", "198.51.100.1:80")
    dial("udp", "[2001:db8::1]:domain")
    dial("udp", "[fe80::1%lo0]:53")
    dial("tcp", ":80")

    Parameters

    Returns Promise<Conn>

env

  • env(): object
  • Returns a snapshot of the environment variables at invocation. Mutating a property in the object will set that variable in the environment for the process. The environment object will only accept strings as values.

      import { env } from "deno";
    
      const myEnv = env();
      console.log(myEnv.SHELL);
      myEnv.TEST_VAR = "HELLO";
      const newEnv = env();
      console.log(myEnv.TEST_VAR == newEnv.TEST_VAR);

    Returns object

    • [index: string]: string

exit

  • exit(exitCode?: number): never
  • Exit the Deno process with optional exit code.

    Parameters

    • Optional exitCode: number

    Returns never

getPrivateValue

  • getPrivateValue<K, V, W>(instance: K, weakMap: WeakMap<K, V>, key: W): V[W]
  • Type parameters

    • K: any

    • V: any

    • W: keyof V

    Parameters

    • instance: K
    • weakMap: WeakMap<K, V>
    • key: W

    Returns V[W]

inspect

  • inspect() converts input into string that has the same format as printed by console.log(...);

    Parameters

    Returns string

isTypedArray

  • isTypedArray(x: unknown): boolean
  • Parameters

    • x: unknown

    Returns boolean

listen

  • Listen announces on the local network address.

    The network must be tcp, tcp4, tcp6, unix or unixpacket.

    For TCP networks, if the host in the address parameter is empty or a literal unspecified IP address, listen() listens on all available unicast and anycast IP addresses of the local system. To only use IPv4, use network tcp4. The address can use a host name, but this is not recommended, because it will create a listener for at most one of the host's IP addresses. If the port in the address parameter is empty or 0, as in 127.0.0.1: or [::1]:0, a port number is automatically chosen. The addr() method of Listener can be used to discover the chosen port.

    See dial() for a description of the network and address parameters.

    Parameters

    Returns Listener

lstat

  • lstat(filename: string): Promise<FileInfo>
  • Queries the file system for information on the path provided. If the given path is a symlink information about the symlink will be returned.

      import { lstat } from "deno";
      const fileInfo = await lstat("hello.txt");
      assert(fileInfo.isFile());

    Parameters

    • filename: string

    Returns Promise<FileInfo>

lstatSync

  • Queries the file system for information on the path provided synchronously. If the given path is a symlink information about the symlink will be returned.

      import { lstatSync } from "deno";
      const fileInfo = lstatSync("hello.txt");
      assert(fileInfo.isFile());

    Parameters

    • filename: string

    Returns FileInfo

makeTempDir

  • makeTempDir creates a new temporary directory in the directory dir, its name beginning with prefix and ending with suffix. It returns the full path to the newly created directory. If dir is unspecified, tempDir uses the default directory for temporary files. Multiple programs calling tempDir simultaneously will not choose the same directory. It is the caller's responsibility to remove the directory when no longer needed.

      import { makeTempDir } from "deno";
      const tempDirName0 = await makeTempDir();
      const tempDirName1 = await makeTempDir({ prefix: 'my_temp' });

    Parameters

    Returns Promise<string>

makeTempDirSync

  • makeTempDirSync is the synchronous version of makeTempDir.

      import { makeTempDirSync } from "deno";
      const tempDirName0 = makeTempDirSync();
      const tempDirName1 = makeTempDirSync({ prefix: 'my_temp' });

    Parameters

    Returns string

metrics

  • Receive metrics from the privileged side of Deno.

    Returns Metrics

mkdir

  • mkdir(path: string, recursive?: boolean, mode?: number): Promise<void>
  • Creates a new directory with the specified path. If recursive is set to true, nested directories will be created (also known as "mkdir -p"). mode sets permission bits (before umask) on UNIX and does nothing on Windows.

      import { mkdir } from "deno";
      await mkdir("new_dir");
      await mkdir("nested/directories", true);

    Parameters

    • path: string
    • Optional recursive: boolean
    • Optional mode: number

    Returns Promise<void>

mkdirSync

  • mkdirSync(path: string, recursive?: boolean, mode?: number): void
  • Creates a new directory with the specified path synchronously. If recursive is set to true, nested directories will be created (also known as "mkdir -p"). mode sets permission bits (before umask) on UNIX and does nothing on Windows.

      import { mkdirSync } from "deno";
      mkdirSync("new_dir");
      mkdirSync("nested/directories", true);

    Parameters

    • path: string
    • Optional recursive: boolean
    • Optional mode: number

    Returns void

open

  • Open a file and return an instance of the File object.

      import * as deno from "deno";
      (async () => {
        const file = await deno.open("/foo/bar.txt");
      })();

    Parameters

    • filename: string
    • Optional mode: OpenMode

    Returns Promise<File>

read

  • read(rid: number, p: Uint8Array): Promise<ReadResult>
  • Read from a file ID into an array buffer.

    Resolves with the ReadResult for the operation.

    Parameters

    • rid: number
    • p: Uint8Array

    Returns Promise<ReadResult>

readAll

  • readAll(r: Reader): Promise<Uint8Array>
  • Read r until EOF and return the content as Uint8Array.

    Parameters

    Returns Promise<Uint8Array>

readDir

  • readDir(path: string): Promise<FileInfo[]>
  • Reads the directory given by path and returns a list of file info.

      import { readDir } from "deno";
      const files = await readDir("/");

    Parameters

    • path: string

    Returns Promise<FileInfo[]>

readDirSync

  • Reads the directory given by path and returns a list of file info synchronously.

      import { readDirSync } from "deno";
      const files = readDirSync("/");

    Parameters

    • path: string

    Returns FileInfo[]

readFile

  • readFile(filename: string): Promise<Uint8Array>
  • Read the entire contents of a file.

      import { readFile } from "deno";
      const decoder = new TextDecoder("utf-8");
      const data = await readFile("hello.txt");
      console.log(decoder.decode(data));

    Parameters

    • filename: string

    Returns Promise<Uint8Array>

readFileSync

  • readFileSync(filename: string): Uint8Array
  • Read the entire contents of a file synchronously.

      import { readFileSync } from "deno";
      const decoder = new TextDecoder("utf-8");
      const data = readFileSync("hello.txt");
      console.log(decoder.decode(data));

    Parameters

    • filename: string

    Returns Uint8Array

readlink

  • readlink(name: string): Promise<string>
  • Returns the destination of the named symbolic link.

      import { readlink } from "deno";
      const targetPath = await readlink("symlink/path");

    Parameters

    • name: string

    Returns Promise<string>

readlinkSync

  • readlinkSync(name: string): string
  • Returns the destination of the named symbolic link synchronously.

      import { readlinkSync } from "deno";
      const targetPath = readlinkSync("symlink/path");

    Parameters

    • name: string

    Returns string

remove

  • remove(path: string, options?: RemoveOption): Promise<void>
  • Removes the named file or directory. Would throw error if permission denied, not found, or directory not empty if recursive set to false. recursive is set to false by default.

      import { remove } from "deno";
      await remove("/path/to/dir/or/file", {recursive: false});

    Parameters

    Returns Promise<void>

removeSync

  • Removes the named file or directory synchronously. Would throw error if permission denied, not found, or directory not empty if recursive set to false. recursive is set to false by default.

      import { removeSync } from "deno";
      removeSync("/path/to/dir/or/file", {recursive: false});

    Parameters

    Returns void

rename

  • rename(oldpath: string, newpath: string): Promise<void>
  • Renames (moves) oldpath to newpath. If newpath already exists and is not a directory, rename() replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

      import { rename } from "deno";
      await rename("old/path", "new/path");

    Parameters

    • oldpath: string
    • newpath: string

    Returns Promise<void>

renameSync

  • renameSync(oldpath: string, newpath: string): void
  • Synchronously renames (moves) oldpath to newpath. If newpath already exists and is not a directory, renameSync() replaces it. OS-specific restrictions may apply when oldpath and newpath are in different directories.

      import { renameSync } from "deno";
      renameSync("old/path", "new/path");

    Parameters

    • oldpath: string
    • newpath: string

    Returns void

resources

  • Returns a map of open file like resource ids along with their string representation.

    Returns ResourceMap

run

setPid

  • setPid(pid_: number): void
  • Parameters

    • pid_: number

    Returns void

stat

  • stat(filename: string): Promise<FileInfo>
  • Queries the file system for information on the path provided. stat Will always follow symlinks.

      import { stat } from "deno";
      const fileInfo = await stat("hello.txt");
      assert(fileInfo.isFile());

    Parameters

    • filename: string

    Returns Promise<FileInfo>

statSync

  • Queries the file system for information on the path provided synchronously. statSync Will always follow symlinks.

      import { statSync } from "deno";
      const fileInfo = statSync("hello.txt");
      assert(fileInfo.isFile());

    Parameters

    • filename: string

    Returns FileInfo

stringifyArgs

  • TODO Do not expose this from "deno" namespace.

    Parameters

    Returns string

symlink

  • symlink(oldname: string, newname: string, type?: string): Promise<void>
  • Creates newname as a symbolic link to oldname. The type argument can be set to dir or file and is only available on Windows (ignored on other platforms).

      import { symlink } from "deno";
      await symlink("old/name", "new/name");

    Parameters

    • oldname: string
    • newname: string
    • Optional type: string

    Returns Promise<void>

symlinkSync

  • symlinkSync(oldname: string, newname: string, type?: string): void
  • Synchronously creates newname as a symbolic link to oldname. The type argument can be set to dir or file and is only available on Windows (ignored on other platforms).

      import { symlinkSync } from "deno";
      symlinkSync("old/name", "new/name");

    Parameters

    • oldname: string
    • newname: string
    • Optional type: string

    Returns void

toAsyncIterator

  • toAsyncIterator(r: Reader): AsyncIterableIterator<Uint8Array>
  • Turns r into async iterator.

     for await (const chunk of toAsyncIterator(reader)) {
         console.log(chunk)
     }

    Parameters

    Returns AsyncIterableIterator<Uint8Array>

truncate

  • truncate(name: string, len?: number): Promise<void>
  • Truncates or extends the specified file, updating the size of this file to become size.

      import { truncate } from "deno";
    
      await truncate("hello.txt", 10);

    Parameters

    • name: string
    • Optional len: number

    Returns Promise<void>

truncateSync

  • truncateSync(name: string, len?: number): void
  • Truncates or extends the specified file synchronously, updating the size of this file to become size.

      import { truncateSync } from "deno";
    
      truncateSync("hello.txt", 10);

    Parameters

    • name: string
    • Optional len: number

    Returns void

write

  • write(rid: number, p: Uint8Array): Promise<number>
  • Write to the file ID the contents of the array buffer.

    Resolves with the number of bytes written.

    Parameters

    • rid: number
    • p: Uint8Array

    Returns Promise<number>

writeFile

  • writeFile(filename: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>
  • Write a new file, with given filename and data.

      import { writeFile } from "deno";
    
      const encoder = new TextEncoder();
      const data = encoder.encode("Hello world\n");
      await writeFile("hello.txt", data);

    Parameters

    Returns Promise<void>

writeFileSync

  • writeFileSync(filename: string, data: Uint8Array, options?: WriteFileOptions): void
  • Write a new file, with given filename and data synchronously.

      import { writeFileSync } from "deno";
    
      const encoder = new TextEncoder();
      const data = encoder.encode("Hello world\n");
      writeFileSync("hello.txt", data);

    Parameters

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc