§Namespaces

§Classes

  • Deno.HttpClient

    UNSTABLE: New API, yet to be vetted. A custom HttpClient for use with fetch.

    const caCert = await Deno.readTextFile("./ca.pem");
    const client = Deno.createHttpClient({ caCerts: [ caCert ] });
    const req = await fetch("https://myserver.com", { client });
    
  • Deno.UnsafeFnPointer

    UNSTABLE: Unsafe and new API, beware!

    An unsafe pointer to a function, for calling functions that are not present as symbols.

  • Deno.UnsafePointer

    UNSTABLE: Unsafe and new API, beware!

    An unsafe pointer to a memory location for passing and returning pointers to and from the ffi

  • Deno.UnsafePointerView

    UNSTABLE: Unsafe and new API, beware!

    An unsafe pointer view to a memory location as specified by the pointer value. The UnsafePointerView API mimics the standard built in interface DataView for accessing the underlying types at an memory location (numbers, strings and raw bytes).

  • WebSocketStream

§Enums

§Functions

  • Deno.addSignalListener

    UNSTABLE: new API, yet to be vetted.

    Registers the given function as a listener of the given signal event.

    Deno.addSignalListener("SIGTERM", () => {
      console.log("SIGTERM!")
    });
    

    NOTE: This functionality is not yet implemented on Windows.

  • Deno.applySourceMap

    UNSTABLE: new API, yet to be vetted.

    Given a current location in a module, lookup the source location and return it.

    When Deno transpiles code, it keep source maps of the transpiled code. This function can be used to lookup the original location. This is automatically done when accessing the .stack of an error, or when an uncaught error is logged. This function can be used to perform the lookup for creating better error handling.

    Note: lineNumber and columnNumber are 1 indexed, which matches display expectations, but is not typical of most index numbers in Deno.

    An example:

    const origin = Deno.applySourceMap({
      fileName: "file://my/module.ts",
      lineNumber: 5,
      columnNumber: 15
    });
    
    console.log(`${origin.fileName}:${origin.lineNumber}:${origin.columnNumber}`);
    
  • Deno.connect

    UNSTABLE: The unix socket transport is unstable as a new API yet to be vetted. The TCP transport is considered stable.

    Connects to the hostname (default is "127.0.0.1") and port on the named transport (default is "tcp"), and resolves to the connection (Conn).

    const conn1 = await Deno.connect({ port: 80 });
    const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
    const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
    const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
    const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
    

    Requires allow-net permission for "tcp" and allow-read for "unix".

  • Deno.connectTls

    UNSTABLE New API, yet to be vetted.

    Create a TLS connection with an attached client certificate.

    const conn = await Deno.connectTls({
      hostname: "deno.land",
      port: 443,
      certChain: "---- BEGIN CERTIFICATE ----\n ...",
      privateKey: "---- BEGIN PRIVATE KEY ----\n ...",
    });
    

    Requires allow-net permission.

  • Deno.consoleSize

    UNSTABLE: New API, yet to be vetted.

    Gets the size of the console as columns/rows.

    const { columns, rows } = Deno.consoleSize(Deno.stdout.rid);
    
  • Deno.createHttpClient

    UNSTABLE: New API, yet to be vetted. Create a custom HttpClient for to use with fetch.

    const caCert = await Deno.readTextFile("./ca.pem");
    const client = Deno.createHttpClient({ caCerts: [ caCert ] });
    const response = await fetch("https://myserver.com", { client });
    
    const client = Deno.createHttpClient({ proxy: { url: "http://myproxy.com:8080" } });
    const response = await fetch("https://myserver.com", { client });
    
  • Deno.dlopen

    UNSTABLE: Unsafe and new API, beware!

    Opens a dynamic library and registers symbols

  • Deno.emit

    UNSTABLE: new API, yet to be vetted.

    Similar to the command line functionality of deno run or deno cache, Deno.emit() provides a way to provide Deno arbitrary JavaScript or TypeScript and have it return JavaScript based on the options and settings provided. The source code can either be provided or the modules can be fetched and resolved in line with the behavior of the command line.

    Requires allow-read and/or allow-net if sources are not provided.

  • Deno.flock

    UNSTABLE: New API should be tested first.

    Acquire an advisory file-system lock for the provided file. exclusive defaults to false.

  • Deno.flockSync

    UNSTABLE: New API should be tested first.

    Acquire an advisory file-system lock for the provided file. exclusive defaults to false.

  • Deno.formatDiagnostics

    UNSTABLE: new API, yet to be vetted.

    Format an array of diagnostic items and return them as a single string in a user friendly format. If there are no diagnostics then it will return an empty string.

    const { diagnostics } = await Deno.emit("file_with_compile_issues.ts");
    console.table(diagnostics);  // Prints raw diagnostic data
    console.log(Deno.formatDiagnostics(diagnostics));  // User friendly output of diagnostics
    console.log(Deno.formatDiagnostics([]));  // An empty string
    
  • Deno.funlock

    UNSTABLE: New API should be tested first.

    Release an advisory file-system lock for the provided file.

  • Deno.funlockSync

    UNSTABLE: New API should be tested first.

    Release an advisory file-system lock for the provided file.

  • Deno.futime

    UNSTABLE: needs investigation into high precision time.

    Changes the access (atime) and modification (mtime) times of a file stream resource referenced by rid. Given times are either in seconds (UNIX epoch time) or as Date objects.

    const file = await Deno.open("file.txt", { create: true, write: true });
    await Deno.futime(file.rid, 1556495550, new Date());
    
  • Deno.futimeSync

    UNSTABLE: needs investigation into high precision time.

    Synchronously changes the access (atime) and modification (mtime) times of a file stream resource referenced by rid. Given times are either in seconds (UNIX epoch time) or as Date objects.

    const file = Deno.openSync("file.txt", { create: true, write: true });
    Deno.futimeSync(file.rid, 1556495550, new Date());
    
  • Deno.hostname

    UNSTABLE: New API, yet to be vetted. Additional consideration is still necessary around the permissions required.

    Get the hostname of the machine the Deno process is running on.

    console.log(Deno.hostname());
    

    Requires allow-env permission.

  • Deno.listen

    UNSTABLE: new API, yet to be vetted.

    Listen announces on the local transport address.

    const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" })
    

    Requires allow-read and allow-write permission.

  • Deno.listenDatagram

    UNSTABLE: new API, yet to be vetted

    Listen announces on the local transport address.

    const listener1 = Deno.listenDatagram({
      port: 80,
      transport: "udp"
    });
    const listener2 = Deno.listenDatagram({
      hostname: "golang.org",
      port: 80,
      transport: "udp"
    });
    

    Requires allow-net permission.

  • Deno.loadavg

    Unstable There are questions around which permission this needs. And maybe should be renamed (loadAverage?)

    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.

    console.log(Deno.loadavg());  // e.g. [ 0.71, 0.44, 0.44 ]
    

    Requires allow-env permission.

  • Deno.osRelease

    Unstable new API. yet to be vetted. Under consideration to possibly move to Deno.build or Deno.versions and if it should depend sys-info, which may not be desireable.

    Returns the release version of the Operating System.

    console.log(Deno.osRelease());
    

    Requires allow-env permission.

  • Deno.refTimer

    UNSTABLE: new API, yet to be vetted.

    Make the timer of the given id blocking the event loop from finishing

  • Deno.removeSignalListener

    UNSTABLE: new API, yet to be vetted.

    Removes the given signal listener that has been registered with Deno.addSignalListener.

    const listener = () => {
      console.log("SIGTERM!")
    };
    Deno.addSignalListener("SIGTERM", listener);
    Deno.removeSignalListener("SIGTERM", listener);
    

    NOTE: This functionality is not yet implemented on Windows.

  • Deno.run

  • Deno.setRaw

    UNSTABLE: new API, yet to be vetted

    Set TTY to be under raw mode or not. In raw mode, characters are read and returned as is, without being processed. All special processing of characters by the terminal is disabled, including echoing input characters. Reading from a TTY device in raw mode is faster than reading from a TTY device in canonical mode.

    The cbreak option can be used to indicate that characters that correspond to a signal should still be generated. When disabling raw mode, this option is ignored. This functionality currently only works on Linux and Mac OS.

    Deno.setRaw(Deno.stdin.rid, true, { cbreak: true });
    
  • Deno.sleepSync

    UNSTABLE*: new API, yet to be vetted.

    SleepSync puts the main thread to sleep synchronously for a given amount of time in milliseconds.

    Deno.sleepSync(10);
    
  • Deno.systemMemoryInfo

    Unstable new API. yet to be vetted.

    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.

    This is similar to the free command in Linux

    console.log(Deno.systemMemoryInfo());
    

    Requires allow-env permission.

  • Deno.umask

    UNSTABLE: New API, yet to be vetted. This API is under consideration to determine if permissions are required to call it.

    Retrieve the process umask. If mask is provided, sets the process umask. This call always returns what the umask was before the call.

    console.log(Deno.umask());  // e.g. 18 (0o022)
    const prevUmaskValue = Deno.umask(0o077);  // e.g. 18 (0o022)
    console.log(Deno.umask());  // e.g. 63 (0o077)
    

    NOTE: This API is not implemented on Windows

  • Deno.unrefTimer

    UNSTABLE: new API, yet to be vetted.

    Make the timer of the given id not blocking the event loop from finishing

  • Deno.utime

    UNSTABLE: needs investigation into high precision time.

    Changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

    await Deno.utime("myfile.txt", 1556495550, new Date());
    

    Requires allow-write permission.

  • Deno.utimeSync

    UNSTABLE: needs investigation into high precision time.

    Synchronously changes the access (atime) and modification (mtime) times of a file system object referenced by path. Given times are either in seconds (UNIX epoch time) or as Date objects.

    Deno.utimeSync("myfile.txt", 1556495550, new Date());
    

    Requires allow-write permission.

  • fetch

§Interfaces

§Type Aliases