Deno supports web APIs as much as possible. This enables developers to use the same APIs that they have been using in the front-end. The only issue with this approach is that, sometimes, the web APIs doesn’t support all the required features. The web standards continually get revised in due time with new features. Sometimes the proposal gets rejected too. For such cases, there are two options:
In this brief article, we’ll go over the fetch API enhancements…
This is a part of the series: Deno’s equivalent of Node.js. In the brief articles that are part of this series, we explore the Deno’s equivalent of commonly used functions in Node.js. The articles are written in no particular order.
In this article, we’ll see the Deno’s equivalent of Node.js’s basic file ops like:
For simplicity, only async variants would be shown.
For each file op, Node.js has callback based functions (old style) and async/sync functions (new style). …
Till Deno v1.11, the (global) Deno namespace was frozen. In other words, it wasn’t editable. If we tried to change it by adding/removing/updating some property, it threw error:
Deno.var1='val1';//error: Uncaught TypeError: Cannot add property var1, object is not extensible
From Deno v1.12, the Deno namespace is no longer frozen. It is available for adding/removing/updating properties. Now, we can do something like this:
Any property changes to Deno namespace would be global, i.e. available across all the modules in the application.
In this article, we’ll go over some use-cases of extending/updating the Deno namespace. …
Deno has two core interfaces: Reader & Writer. Readers are useful in getting data from a source, while Writers are useful in writing data to a sink. The basic concept behind Readers, Writers, Seekers, and Closers is explained in an article here. Deno also comes with some utility functions that works on Readers & Writers without worrying about the type of source & sink.
One of the commonly used utility function is: copy. The copy function reads the data from the Reader till EOF & writes it into the Writer. The reading & writing work is done in chunks. …
Deno supports crypto functions by implementing web’s crypto APIs. The previous comparison (part 1) covering getRandomValues, randomUUID, and digest is here. From Deno v1.12, more crypto functions have been added: generateKey, sign, and verify.
In this article, we’ll compare the new crypto functions with their Node.js equivalents. All the time units are in miliseconds.
The generateKey function is useful in generating symmetric (like AES) and asymmetric keys (like RSA). In Deno v1.2, it supports generation of asymmetric keys only. The support should extend to symmetric keys in future.
There are four keygen algorithms to choose from. …
One of the close competitors is Spring Boot. Spring boot is a light-weight server technology built over Java that’s mostly used for web services. In their own words:
Spring Boot makes it easy to create…
In Deno, resources are one of the basic building blocks that represent things like input, output, client connections, server socket, files, web socket, etc. All the resources have a simple incrementing resource ID.
There are standard resources like stdin, stdout, and stderr that are opened at startup time. The standard resource IDs are:
All the other resources like client connections, server sockets, file, etc. need to be opened explicitly. The opening of resource varies as per the type of resource. The resource IDs for these resources start from 3 and increments by 1.
One of the close competitors is Go. Go’s popularity is increasing day by day. In their own words:
Go is an open source programming language that makes it easy to build simple, reliable, and efficient…
Deno supports crypto functions by implementing web’s crypto APIs. At the time of writing (Deno v1.11.x), there is a small set of crypto functions available: randomUUID, getRandomValues, subtle.digest. However, the number increases with every release. A follow-up article will be published when the Deno crypto API increases the functionality.
In this article, we’ll find out how Deno’s crypto functions perform in comparison to Node.js.
This synchronous function generates a V4 UUID. The usage is same in Deno and Node.js.
Here is the comparison of performance for 100K, 500K, and 1M sequential calls to the…
As Deno is a complete tool chain, it comes bundled with a test framework that is very good to do unit testing of an application. With a large collection of asserts, feature rich framework, and complete functionality of Deno, the unit test framework is flexible enough to write any kind of tests (you can read about unit testing here & here).
The test framework isn’t limited to unit testing. With complete Deno functionality available to use, the test framework can easily do integration testing as well (you can read about it here).
The integration testing is still sequential, i.e. a…
Mayank has more than 18 years of software experience, with the last few years in developing high performance production grade microservices in Node.js.