What is Deno?
In 2018, Ryan revealed Deno in one of the conferences where he was giving a talk about shortcomings of Node, and at the end of that presentation, he revealed a more secure and improved version of Node, i.e. Node V2.
Features of Deno
1. Integrated Typescript
Deno has its typescript configuration JSON file called tsconfig.json, but you can override it using the following command:
deno run -c tsconfig.json [your-script.ts]
Node.js lagged somehow in security. In Node.JS, you can read and write into the filesystem, make outgoing requests, access environment variables, and so on. It can be an easy bug bounties for security researchers, if you aren’t careful while writing your code.
No worries now, Deno has your back. Deno uses command-line arguments to enable or disable access to different security features. So if you need your script to be able to access the /etc folder, you can do
deno --allow-read=/etc myscript.ts
That would allow your code to read from the folder, and raises security exception if try to access anything else. This is similar to how other platforms handle security. Android users can relate this feature as before installing any application, they are asked to grant permissions to various system applications like camera, microphone, phone, and more. By using these flags as part of the command line that executes your script, you’re providing the permissions required by your code.
3. Improved Dependency Handling
No package.json, no node_modules, So how does Deno handle dependencies? In deno, you can import modules from anywhere. You need to specify the version of the libraries in the URL itself.
The package.json is replaced by deps.ts, which appears like:
4. Standard Library Features
Deno comes with the tools to add color to terminal text, work with external data structures (such as binary, CSV, YAML, and others), generate UUIDs, and even write WebSockets. There are other, more basic modules available as well, such as file system access, date helper functions, HTTP-related functions, and more.
5. Other Features
Deno has a wide range of features like more oversized tooling out of the box with things such as a test runner, debugger, file watcher, and others.
Ryan Dahl stated, “Deno’s performance on the webserver is about equal to Node, but Deno has better latency than Node.”
“A hello-world Deno HTTP server does about 25k requests per second with a max latency of 1.3 milliseconds. A comparable Node program makes 34k requests per second with a rather erratic max latency between 2 and 300 milliseconds,” he notes.
Deno V/S Node
Difference between Node & Deno
|Engine||Chromium V8||Chromium V8|
|Security||Permission-based Access||Full Access|
|Package Management||URL’s||npm and mode modules|
|Typescript Support||Built-in||Not built-in|
Deno is no different, simply because right now, it’s just the culmination of around 2 years of work on an idea. It hasn’t been tried and tested in production systems and applications yet. It hasn’t been reviewed and put into weird and unintended use cases to see how it deals with those border situations where node js didn’t. And until it does, it’ll just be a toy for early adopters to explore and play with. As it’s a framework of the most loved language, we’ll start hearing from developers and companies sharing their experiences with Deno and how they’ve solved the newly found shortcomings, and eventually, it will be adapted where it should be to fill the patches of NodeJS.
Will it replace Node then? Who knows! We’ll have to wait and see. Drop your views in the comment section!