There are APIs that are built into the Deno CLI that are beyond those that are built-ins for JavaScript, including APIs that are unstable or experimental. In order to use APIs marked as unstable, you will need to use --unstable
on the command line to make them available. All the APIs are a combination of web platform APIs Deno has implemented and Deno specific APIs.
We try to keep non-standard, Deno specific, APIs in the Deno
namespace. We have grouped the APIs into the following functional categories.
Compression Streams API
An API for compressing a stream of data. | |
An API for decompressing a stream of data. |
Console and Debugging
Option which can be specified when performing | |
A symbol which can be used as a key for a custom method which will be
called when | |
Converts the input into a string that has the same format as printed by
|
Cron
Create a cron job that will periodically execute the provided handler callback based on the specified schedule. |
DOM APIs
The MessageChannel interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. | |
The MessagePort interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. | |
This type has been renamed to StructuredSerializeOptions. Use that type for new code. | |
Creates a deep copy of a given value using the structured clone algorithm. |
DOM Events
I v | An event which takes place in the DOM. |
EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. | |
Events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an , , , or ). | |
Registers an event listener in the global scope, which will be called
synchronously whenever the event | |
Dispatches an event in the global scope, synchronously invoking any registered event listeners for this event in the appropriate order. Returns false if event is cancelable and at least one of the event handlers which handled this event called Event.preventDefault(). Otherwise it returns true. | |
Remove a previously registered event listener from the global scope |
Encoding API
f | Decodes a string of data which has been encoded using base-64 encoding. |
f | Creates a base-64 ASCII encoded string from the input string. |
Errors
A set of error constructors that are raised by Deno APIs. | |
Raised when attempting to open a server listener on an address and port that already has a listener. | |
Raised when the underlying operating system reports an | |
Raised when trying to create a resource, like a file, that already exits. | |
The underlying IO resource is invalid or closed, and so the operation could not be performed. | |
Raised when trying to write to a resource and a broken pipe error occurs.
This can happen when trying to write directly to | |
Raised when the underlying IO resource is not available because it is being awaited on in another block of code. | |
Raised when the underlying operating system reports an | |
Raised when the underlying operating system reports that a connection to a resource is refused. | |
Raised when the underlying operating system reports that a connection has been reset. With network servers, it can be a normal occurrence where a client will abort a connection instead of properly shutting it down. | |
Raised when too many symbolic links were encountered when resolving the filename. | |
Raised in situations where when attempting to load a dynamic import, too many redirects were encountered. | |
Raised when the underlying operating system reports an | |
Raised when an operation to returns data that is invalid for the operation being performed. | |
Raised when trying to open, create or write to a directory. | |
Raised when performing a socket operation but the remote host is not reachable. | |
Raised when trying to perform an operation on a path that is not a directory, when directory is required. | |
Raised when the underlying operating system reports an | |
Raised when the underlying operating system indicates that the file was not found. | |
Raised when the underlying Deno API is asked to perform a function that is not currently supported. | |
Raised when the underlying operating system indicates the current user
which the Deno process is running under does not have the appropriate
permissions to a file or resource, or the user did not provide required
| |
Raised when the underlying operating system reports that an I/O operation
has timed out ( | |
Raised when attempting to read bytes from a resource, but the EOF was unexpectedly encountered. | |
Raised when the underlying operating system would need to block to complete but an asynchronous (non-blocking) API is used. | |
Raised when expecting to write to a IO buffer resulted in zero bytes being written. |
ES Modules
Deno provides extra properties on |
Fetch API
I | |
Basic authentication credentials to be used with a | |
The options used when creating a | |
A custom | |
The definition of a proxy when specifying
| |
I v | Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". |
I v | This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples). In all methods of this interface, header names are matched by case-insensitive byte sequence. |
I v | This Fetch API interface represents a resource request. |
I v | This Fetch API interface represents the response to a request. |
Create a custom HttpClient to use with | |
The Fetch API
which also supports setting a |
FFI
An unsafe function pointer for passing JavaScript functions as C function pointers to foreign function calls. | |
An unsafe pointer to a function, for calling functions that are not present as symbols. | |
A collection of static functions for interacting with pointer objects. | |
An unsafe pointer view to a memory location as specified by the | |
A dynamic library resource. Use | |
The interface for a foreign function as defined by its parameter and result types. | |
A foreign library interface descriptor. | |
Definition of a unsafe callback function. | |
This magic code used to implement better type hints for | |
Type conversion for foreign symbol return types. | |
Type conversion for foreign symbol return types and unsafe callback parameters. | |
All BigInt number types for interfacing with foreign functions. | |
The native boolean type for interfacing to foreign functions. | |
The native buffer type for interfacing to foreign functions. | |
The native function type for interfacing with foreign functions. | |
All plain number types for interfacing with foreign functions. | |
The native pointer type for interfacing to foreign functions. | |
The native struct type for interfacing with foreign functions. | |
All supported types for interfacing with foreign functions. | |
The native void type for interfacing with foreign functions. | |
A non-null pointer, represented as an object
at runtime. The object's prototype is | |
Pointers are represented either with a | |
A utility type that infers a foreign library interface. | |
A utility type that infers a foreign symbol. | |
A utility type for conversion of parameter types of foreign functions. | |
Type conversion for unsafe callback return types. | |
Type conversion for foreign symbol parameters and unsafe callback return types. | |
An unsafe callback function. | |
Opens an external dynamic library and registers symbols, making foreign functions available to be called. |
File System
The Deno abstraction for reading and writing files. | |
Information about a directory entry returned from | |
Provides information about a file and is returned by
| |
Represents a unique file system event yielded by a
| |
Returned by | |
Options which can be set when using | |
Options which can be set when using | |
Options which can be set when doing | |
Options which can be set when using | |
Options which can be set when using | |
Options that can be used with | |
Options for writing to a file. | |
Additional information for FsEvent objects with the "other" kind. | |
The Deno abstraction for reading and writing files. | |
Changes the permission of a specific file/directory of specified path. Ignores the process's umask. | |
Synchronously changes the permission of a specific file/directory of specified path. Ignores the process's umask. | |
Change owner of a regular file or directory. | |
Synchronously change owner of a regular file or directory. | |
Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable. | |
Synchronously copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable. | |
Creates a file if none exists or truncates an existing file and resolves to
an instance of | |
Creates a file if none exists or truncates an existing file and returns
an instance of | |
Acquire an advisory file-system lock for the provided file. | |
Acquire an advisory file-system lock synchronously for the provided file. | |
Returns a | |
Synchronously returns a | |
Truncates or extends the specified file stream, to reach the specified
| |
Synchronously truncates or extends the specified file stream, to reach the
specified | |
Release an advisory file-system lock for the provided file. | |
Release an advisory file-system lock for the provided file synchronously. | |
Changes the access ( | |
Synchronously changes the access ( | |
Creates | |
Synchronously creates | |
Resolves to a | |
Synchronously returns a | |
Creates a new temporary directory in the default directory for temporary
files, unless | |
Synchronously creates a new temporary directory in the default directory
for temporary files, unless | |
Creates a new temporary file in the default directory for temporary
files, unless | |
Synchronously creates a new temporary file in the default directory for
temporary files, unless | |
Creates a new directory with the specified path. | |
Synchronously creates a new directory with the specified path. | |
Open a file and resolve to an instance of | |
Synchronously open a file and return an instance of
| |
Reads the directory given by | |
Synchronously reads the directory given by | |
Reads and resolves to the entire contents of a file as an array of bytes.
| |
Synchronously reads and returns the entire contents of a file as an array
of bytes. | |
Resolves to the full path destination of the named symbolic link. | |
Synchronously returns the full path destination of the named symbolic link. | |
Asynchronously reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error. | |
Synchronously reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error. | |
Resolves to the absolute normalized path, with symbolic links resolved. | |
Synchronously returns absolute normalized path, with symbolic links resolved. | |
Removes the named file or directory. | |
Synchronously removes the named file or directory. | |
Renames (moves) | |
Synchronously renames (moves) | |
Resolves to a | |
Synchronously returns a | |
Creates | |
Creates | |
Truncates (or extends) the specified file, to reach the specified | |
Synchronously truncates (or extends) the specified file, to reach the
specified | |
Retrieve the process umask. If | |
Changes the access ( | |
Synchronously changes the access ( | |
Watch for file system events against one or more | |
Write | |
Synchronously write | |
Write string | |
Synchronously write string |
HTTP Server
The async iterable that is returned from | |
An instance of the server created using | |
The event yielded from an | |
Information for a HTTP request. | |
Options which can be set when calling | |
Additional options which are used when opening a TLS (HTTPS) server. | |
Information for a unix domain socket HTTP request. | |
A handler for HTTP requests. Consumes a request and returns a response. | |
A handler for unix domain socket HTTP requests. Consumes a request and returns a response. | |
Serves HTTP requests with the given option bag. | |
Allows "hijacking" the connection that the request is associated with. This
can be used to implement protocols that build on top of HTTP (eg.
|
I/O
A variable-sized buffer of bytes with | |
An abstract interface which when implemented provides an interface to close files/resources that were previously opened. | |
An abstract interface which when implemented provides an interface to read bytes into an array buffer asynchronously. | |
An abstract interface which when implemented provides an interface to read bytes into an array buffer synchronously. | |
An abstract interface which when implemented provides an interface to seek within an open file/resource asynchronously. | |
An abstract interface which when implemented provides an interface to seek within an open file/resource synchronously. | |
An abstract interface which when implemented provides an interface to write bytes from an array buffer to a file/resource asynchronously. | |
An abstract interface which when implemented provides an interface to write bytes from an array buffer to a file/resource synchronously. | |
A reference to | |
A reference to | |
A reference to | |
Close the given resource ID ( | |
Gets the size of the console as columns/rows. | |
Copies from | |
Flushes any pending data operations of the given file stream to disk. | |
Synchronously flushes any pending data operations of the given file stream to disk. | |
Flushes any pending data and metadata operations of the given file stream to disk. | |
Synchronously flushes any pending data and metadata operations of the given file stream to disk. | |
Check if a given resource id ( | |
Turns a Reader, | |
Turns a ReaderSync, | |
Read from a resource ID ( | |
Read Reader | |
Synchronously reads Reader | |
Synchronously read from a resource ID ( | |
Seek a resource ID ( | |
Synchronously seek a resource ID ( | |
Write to the resource ID ( | |
Write all the content of the array buffer ( | |
Synchronously write all the content of the array buffer ( | |
Synchronously write to the resource ID ( | |
A enum which defines the seek mode for IO related APIs that support seeking. |
Jupyter
A namespace containing runtime APIs available in Jupyter notebooks. | |
A collection of supported media types and data for Jupyter frontends. | |
Broadcast a message on IO pub channel. | |
Display function for Jupyter Deno Kernel.
Mimics the behavior of IPython's | |
Format an object for displaying in Deno | |
Show HTML in Jupyter frontends with a tagged template function. | |
Show Markdown in Jupyter frontends with a tagged template function. | |
SVG Tagged Template Function. |
KV
An operation on a | |
A key-value database that can be used to store and retrieve data. | |
An iterator over a range of data entries in a | |
Wrapper type for 64-bit unsigned integers for use as values in a
| |
A check to perform as part of a | |
Options for listing key-value pairs in a | |
Consistency level of a KV operation. | |
A versioned pair of key and value in a | |
An optional versioned pair of key and value in a | |
A key to be persisted in a | |
A single part of a | |
A selector that selects the range of data returned by a list operation on a
| |
A mutation to a key in a | |
Open a new |
Network
If | |
A generic transport listener for message-oriented protocols. | |
A generic network listener for stream-oriented protocols. | |
Represents membership of a IPv4 multicast group. | |
Represents membership of a IPv6 multicast group. | |
If | |
If | |
The information for a network interface returned from a call to
| |
Options which can be set when using | |
If | |
If | |
Unstable options which can be set when opening a datagram listener via
| |
Unstable options which can be set when opening a Unix listener via
| |
The type of the resource record to resolve via DNS using
| |
Specialized listener that accepts TLS connections. | |
Connects to the hostname (default is "127.0.0.1") and port on the named
transport (default is "tcp"), and resolves to the connection ( | |
Create a TLS connection with an attached client certificate. | |
Listen announces on the local transport address. | |
Listen announces on the local transport address. | |
Listen announces on the local transport address over TLS (transport layer security). | |
Returns an array of the network interface information. | |
Performs DNS resolution against the given query, returning resolved records. | |
Shutdown socket send operations. | |
Start TLS handshake from an existing connection using an optional list of CA certificates, and hostname (default is "127.0.0.1"). Specifying CA certs is optional. By default the configured root certificates are used. Using this function requires that the other end of the connection is prepared for a TLS handshake. |
Observability
A map of open resources that Deno is tracking. The key is the resource ID (rid) and the value is its representation. | |
Returns an array containing the 1, 5, and 15 minute load averages. The load average is a measure of CPU and IO utilization of the last one, five, and 15 minute periods expressed as a fractional number. Zero means there is no load. On Windows, the three values are always the same and represent the current load, not the 1, 5 and 15 minute load averages. | |
Receive metrics from the privileged side of Deno. This is primarily used in the development of Deno. Ops, also called bindings, are the go-between between Deno JavaScript sandbox and the rest of Deno. | |
Returns a map of open resource IDs (rid) along with their string
representations. This is an internal API and as such resource
representation has |
Performance
Deno supports User Timing Level 3 which is not widely supported yet in other runtimes. | |
Encapsulates a single performance metric that is part of the performance
timeline. A performance entry can be directly created by making a performance
mark or measure (for example by calling the | |
| |
Options which are used in conjunction with | |
| |
Options which are used in conjunction with | |
Permissions
Deno's permission management API. | |
An | |
The permission descriptor for the | |
The permission descriptor for the | |
The permission descriptor for the | |
The permission descriptor for the | |
A set of options which can define the permissions within a test or worker context at a highly specific level. | |
The interface which defines what event types are supported by
| |
The permission descriptor for the | |
The permission descriptor for the | |
The permission descriptor for the | |
The permission descriptor for the | |
Permission descriptors which define a permission and can be queried, requested, or revoked. | |
The name of a privileged feature which needs permission. | |
Options which define the permissions within a test or worker context. | |
The current status of the permission: | |
Deno's permission management API. |
Runtime Environment
An interface containing methods to interact with the process environment variables. | |
Information returned from a call to | |
Operating signals which can be listened for or sent to sub-processes. What signals and what their standard behaviors are OS dependent. | |
Returns the script arguments to the program. | |
Information related to the build of the current Deno runtime. | |
An interface containing methods to interact with the process environment variables. | |
The URL of the entrypoint module entered from the command-line. It requires read permission to the CWD. | |
Reflects the | |
The current process ID of this instance of the Deno CLI. | |
The process ID of parent process of this instance of the Deno CLI. | |
Version information related to the current Deno CLI runtime environment. | |
Registers the given function as a listener of the given signal event. | |
Change the current working directory to the specified path. | |
Return a string representing the current working directory. | |
Returns the path to the current deno executable. | |
Exit the Deno process with optional exit code. | |
Returns the group id of the process on POSIX platforms. Returns null on windows. | |
Get the | |
Returns an object describing the memory usage of the Deno process and the V8 subsystem measured in bytes. | |
Returns the release version of the Operating System. | |
Returns the Operating System uptime in number of seconds. | |
Removes the given signal listener that has been registered with
| |
Displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. | |
Returns the user id of the process on POSIX platforms. Returns null on Windows. |
Scheduling
A microtask is a short function which is executed after the function or module which created it exits and only if the JavaScript execution stack is empty, but before returning control to the event loop being used to drive the script's execution environment. This event loop may be either the main event loop or the event loop driving a web worker. |
Streams API
This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. | |
This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. | |
This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. | |
This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. | |
This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. | |
Sub Process
The interface for handling a child process returned from
| |
Create a child process. | |
| |
Options which can be set when calling | |
The interface returned from calling | |
These are unstable options which can be used with | |
Send a signal to process under given | |
Spawns new subprocess. RunOptions must contain at a minimum the |
Testing
Context that is passed to a benchmarked function. The instance is shared between iterations of the benchmark. Its methods can be used for example to override of the measured portion of the function. | |
The interface for defining a benchmark test using | |
Context that is passed to a testing function, which can be used to either gain information about the current test, or register additional test steps within the current test. | |
Register a test which will be run when | |
Register a benchmark test which will be run when |
Timers
Cancels a timed, repeating action which was previously started by a call
to | |
Cancels a scheduled action initiated by | |
Make the timer of the given | |
Make the timer of the given | |
Repeatedly calls a function , with a fixed time delay between each call. | |
Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns an id which may be used to cancel the timeout. |
Web APIs
A controller object that allows you to abort one or more DOM requests as and when desired. | |
A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. | |
I v | The location (URL) of the object it is linked to. Changes done on it are
reflected on the object it relates to. Accessible via
|
I v | The URL interface represents an object providing static methods used for creating object URLs. |
The URLPattern API provides a web platform primitive for matching URLs based on a convenient pattern syntax. | |
| |
I v | |
v | |
v | |
Shows the given message and waits for the enter key pressed. | |
Shows the given message and waits for the answer. Returns the user's answer as boolean. | |
Shows the given message and waits for the user's input. Returns the user's input as string. | |
Dispatch an uncaught exception. Similar to a synchronous version of: |
Web Crypto API
I v | |
The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. | |
The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm. | |
This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). | |
Web File API
I v | A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. |
I v | Provides information about files and allows JavaScript in a web page to access their content. |
Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. | |
Web Sockets
Options which can be set when performing a
| |
The object that is returned from a | |
Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. | |
Upgrade an incoming HTTP request to a WebSocket. |
Web Storage API
I v | This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. |
WebAssembly
The | |
A | |
A | |
The | |
The | |
A | |
The | |
The | |
The | |
The | |
A | |
A | |
The | |
The value returned from | |
The | |
The | |
The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code. | |
The | |
The |
Uncategorized
N | The global namespace where Deno specific, non-standard APIs are located. |