Deno (software)

Deno is a runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language. It was created by Ryan Dahl, original creator of Node.js, and is focused on security and productivity.[5] It was announced by Dahl in 2018 during his talk "10 Things I Regret About Node.js".[6] Deno explicitly takes on the role of both runtime and package manager within a single executable, rather than requiring a separate package-management program.[7][8]

Original author(s)Ryan Dahl
Initial releaseMay 13, 2018 (2018-05-13)[1]
Preview release
0.22.0 / October 28, 2019 (2019-10-28)[2]
Written inTypeScript, JavaScript, Rust, C++
Operating systemLinux, macOS, Microsoft Windows
TypeRun-time environment
LicenseMIT license[3][4]


Deno was announced on JSConf EU 2018 by Ryan Dahl in his talk "10 Things I Regret About Node.js".[6] In his talk, Ryan mentioned his regrets about the initial design decisions with Node.js, focusing on his choices of not using Promises in API design, usage of the legacy GYP building system, node_modules and package.json, leaving out file extensions, magical module resolution with index.js and breaking the sandboxed environment of V8.[9] He eventually presented the prototype of Deno, aiming to achieve system call bindings through message passing with serialization tools such as Protocol Buffers, and to provide command line flags for access control.

Deno was initially written in Go and used Protocol Buffers for serialization between privileged (Go, with system call access) and unprivileged (V8) sides.[10] However, Go was soon replaced with Rust due to concerns of double runtime and garbage collection pressure.[11] Tokio is introduced in place of libuv as the asynchronous event-driven platform,[12] and Flatbuffers is adopted for faster, "zero-copy" serialization and deserialization[13] but later in August 2019, FlatBuffers were finally removed[14] after publishing benchmarks that measured an significant overhead of serialization in April 2019.[15]

A standard library, modeled after Go's standard library, was created in November 2018 to provide extensive tools and utilities, partially solving Node.js' dependency tree explosion problem.[16]


Deno aims to be a productive and secure scripting environment for the modern programmer.[7] Similar to Node.js, Deno emphasize on event-driven architecture, providing a set of non-blocking core IO utilities, along with their blocking versions. Deno could be used to create web servers, perform scientific computations, etc.

Comparison with Node.js

Deno and Node.js are both runtimes built on Google's V8 JavaScript engine, the same engine used in Google Chrome. They both have internal event loops and provide command-line interfaces for running scripts and a wide range of system utilities.

In the meantime, Deno mainly deviates from Node.js in the following aspects[7]:

  1. Uses ES Module as the default module system, instead of CommonJS.
  2. Uses URLs for loading local or remote dependencies, similar to browsers.
  3. Includes a built-in package manager for resource fetching, thus no need for NPM.
  4. Supports TypeScript out of the box, using a snapshotted TypeScript compiler with caching mechanisms.
  5. Aims better compatibility with browsers with a wide range of Web API.
  6. Allows control to file system and network access in order to run sandboxed code.
  7. Redesigns API to utilize Promises, ES6 and TypeScript features.
  8. Minimizes core API size, while providing a large standard library with no external dependencies.
  9. Using message passing channels for invoking privileged system APIs and using bindings.


The following runs a basic Deno script without any read/write/network permissions (sandbox mode):

deno run main.ts

Explicit flags are required to expose corresponding permission:

deno run --allow-read --allow-net main.ts

To inspect the dependency tree of the script, use the info subcommand:

deno info main.ts

A basic hello-world program in Deno looks like the following (as in Node.js):

console.log("Hello world");

Deno provides the global namespace for most Deno specific APIs that are not available in the browser. A Unix cat program could be implemented as follows:

/* cat.ts */

/* Deno APIs are exposed through the `Deno` namespace. */
const { stdout, open, copy, args } = Deno;

// Top-level await is supported
for (let i = 1; i < args.length; i++) {
    const filename = args[i]; // Obtains command-line arguments.
    const file = await open(filename); // Opens the corresponding file for reading.
    await copy(stdout, file); // Performs a zero-copy asynchronous copy from `file` to `stdout`.

The above Deno.copy function works in the similar way as Go's io.Copy, where stdout (standard output) is the destination Writer and file is the source Reader. To run this program, we need to provide the read permission to the filesystem:

deno run --allow-read cat.ts myfile

The following Deno script implements a basic HTTP server:

// Imports `serve` from the remote Deno standard library, using URL.
import { serve } from "";

const body = new TextEncoder().encode("Hello World\n");
// `serve` function returns an asynchronous iterator, yielding a stream of requests
for await (const req of serve(":8000")) {
    req.respond({ body });

When running this program, Deno would automatically download and cache the remote standard library files and compile the code. Similarly, we can run a standard library script (such as a file server) directly without explicitly downloading, by providing the URL as input filename (-A turns on all permissions):

$ deno run -A
HTTP server listening on


  1. "Contributors, denoland/deno, Github". Retrieved 5 July 2019.
  2. "Deno 0.22.0". Retrieved 28 October 2019 via GitHub.
  3. "deno/LICENSE at master". GitHub. Retrieved 5 July 2019.
  4. "The MIT License". Open Source Initiative. 17 September 2018. Retrieved 17 September 2018.
  5. "Deno: Secure V8 TypeScript Runtime from Original Node.js Creator". InfoQ. Retrieved 2019-05-17.
  6. JSConf (2018-06-06), 10 Things I Regret About Node.js - Ryan Dahl - JSConf EU 2018, retrieved 2019-05-17
  7. "Deno Manual". Retrieved 2019-05-17.
  8. Paul Krill (2018-06-21). "Ryan Dahl's Node.js regrets lead to Deno". InfoWorld.
  9. Dahl, Ryan (2018-06-06). "Design mistakes in Node" (PDF). Github.
  10. "denoland/deno, branch "golang"". Github.
  11. "Suggestion: Look into porting to Rust and using Tokio". GitHub.
  12. "Tokio - The asynchronous run-time for the Rust programming language".
  13. "Protobuf seems like a lot of overhead for this use case?". Github.
  14. "Remove flatbuffers". GitHub.
  15. "Replace flatbuffers". GitHub.
  16. "denoland/deno_std: deno standard modules". Github.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.