Deno is perhaps the most recent addition in the server-side runtimes/frameworks. Deno is a simple, modern, and secure runtime for JavaScript and TypeScript applications that uses V8 and is built in Rust. Out of all the old or new server-side runtimes/frameworks, Deno could be seen as a successor of Node.js.

Deno differentiates itself with some unique features like:

  • Security: Deno is secure by default. Unless explicitly enabled, there is no file, network, or environment access. It’s almost like running it in a container.
  • Typescript support: Deno supports Typescript out of the box. Unlike Node.js, …


Deno’s standard library comes with very useful utility functions for benchmarking any piece of code. The piece of code could be in the same file or imported from some other module (the most likely case).

The benchmarking functions could be used inside Deno’s testing functions deno.test, therefore they also integrate easily with CI (continuous integration). The benchmarking script could be present in the same directory as the other tests so that it can run along with the standard unit tests deno test .

Similar to the testing functions, benchmarking functions also need to be registered before they are executed. …


Deno isn’t just an execution environment, it’s a complete toolchain. Deno ships as a single executable, and it offers all its functionality through commands (sometimes called subcommands). The most widely used commands are run and test (of course!). In addition to the popular commands, there is a lesser-known, but very useful command called, eval. As the name indicates, eval is a command that’s useful for quick evaluation of a piece of code.

The name of the eval command has similarities to the JS eval function, but the one in Deno is very different. The JS eval function executes inside the…


The purpose of this article is to learn how to read the last N bytes from a file in Deno. Some applications may need to read the contents of a file from the end rather than reading the file from the start. For example — tailing utility.

The file could be of any size: small or large.

If the file is small, here is how to go about it:

  • Read the entire file into memory (Uint8Array)
  • Slice the array array.length-N

The above approach for getting the last N bytes from a small file is good. …


As Deno is a backend runtime, there may be situations when a big file (500M, 1G, 2G, 5G, etc.) needs to be processed. The question is:

How to go about processing a large file?

An obvious answer would be to process the file line-by-line. The answer is right, but for files that have lines. What if the large file doesn’t have lines. For example — a file that holds more than a gig of some comma-separated readings. All the readings would be present in the same line. Processing line-by-line doesn’t work in such cases.

There are two ways to process…


While Deno is primarily designed for webapps, Deno could also be used to write interactive command-line applications. The primary driver for building command-line apps in Deno is its ability to build standalone executable applications that can run anywhere without any dependencies. This way an application could be shipped without worrying about installation, download, etc.

A lot of command-line applications are interactive i.e. they need to collect data from users. Deno’s core runtime comes with three easy to use functions for writing interactive command-line applications:

  • alert: Writes a message on the console
  • prompt: Get input from the user
  • confirm: Get a…


The purpose of this article is to learn how to respond with a multipart/form-data in Deno. This could be one of those less frequently used cases, but some of the applications might need this capability. For example — an application may want to respond with file metadata and the file together (in the same HTTP response). Multipart/form-data comes to the rescue for these types of cases.

Deno’s standard library comes with a very easy-to-use multipart writer. As expected, the multipart writer is useful in preparing a multipart/form-data body that could contain fields and files.


To use the multipart writer, the…

Disclaimer: This parser is written by me

There are several third-party body parsers available for Deno, but neither of them covers most of the common content types nor works as a standalone parser. Some of the good parsers need to be used with third-party frameworks like oak, etc.

The purpose of the universal body parser is to offer body parsing functionality without getting associated with any framework or in other words, work independently.


This is a universal body-parser for Deno that provides an easy interface to parse most of the common content types. The user need not worry at all…


Some of the applications could have a need to monitor and get notified of any changes to the files present in one or more locations in the local file system. The use cases might be watching a config file, reloading changed ES modules dynamically, get notified for new files, etc.

Deno’s core runtime comes with an async file watcher that has the ability to recursively watch multiple locations and notify users about any changes. The file watcher is generic to cover all the cases like:

  • create
  • modify
  • remove

The file watcher notifies about the above events for affected files/directories, however…


Any web apps developed in Deno would need the ability to get, set, and delete cookies from request and response. Cookies are very useful in sending and receiving session-related data, past data, user preferences, etc. from the user’s browser. At the HTTP level, cookies are exchanged via HTTP headers.

Deno’s standard library comes with utility functions to work with cookies. The get, set, and delete functions are very simple to use.

Basic Usage

To work with cookies, import the following from the standard library:

import * as cookie from "";

Or, use explicit functions:

import { deleteCookie, setCookie, getCookies } from "";

Mayank Choubey

Mayank has more than 17 years of software experience, with last few years in developing high performance production grade microservices in Node.js.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store