Deno
Published on 23 Aug 2021
What is Deno?
As per the definition, deno is a simple, modern and secure runtime for Javascript and Typescript which is built on V8, Rust and Tokio.
It has recently been announced the compatibility on MDN.
Feature
- Supports Typescript
- Ships a single executable
- Has built-in utilities like a code formatter (
deno fmt
), a linter (deno lint
), and a test runner (deno test
). - Can bundle scripts into a single JavaScript file.
- Set of reviewed standard modules that are guaranteed to work with Deno.
How to download Deno?
You can download from the official website.
Hello World with Deno!
Deno runs on Typescript, no additional config tools like webpack or bundle is required to compile. We can use both Javascript or Typescript with Deno.
I will be using Typescript to run a simple program
Command: deno run hello-world.ts
:
Let’s see more good examples with import
modules
Command: deno run import-example.ts
:
Comparison to Node.js
- Deno doesn’t use
npm
, it uses URLs or file paths. - Deno doesn’t use
package.json
. - All async actions in Deno return a promise, thus Deno provides different APIs than node.
- Deno requires explicit permission for file, network or environment access which makes it more secure.
- Deno dies in uncaught errors.
- Deno uses “ES modules” and doesn’t support
require()
and third party modules are imported via URLs with above import module example:
More information can be found in manual doc.