Examples and learning materials about Deno

Examples and learning materials about Deno

Deno is an alternative to Node, which also uses JavaScript and TypeScript.Just as Node, it's a Javascript Runtime based on Chrome's V8\. However, the Deno executable is also able to execute uncompiled TypeScript code, because it has its own TypeScript compiler embedded.

Deno

Deno is an alternative to Node, which also uses JavaScript and TypeScript.

Just as Node, it's a Javascript Runtime based on Chrome's V8. However, the Deno executable is also able to execute uncompiled TypeScript code, because it has its own TypeScript compiler embedded.

Deno is "secured by default", it means it requires explicit execution permissions.

Why ?

In short, Ryan Dahl, the creator of Node came out with Deno because he was unhappy of the mistakes he made with his first runtime project.

It's a chance to "make Node better".

The main enhancements compared to Node are:

  • TypeScript native support
  • Modern JS features
  • URL imports
  • Script permissions

Install Deno

Execute code

deno run app.ts

=> Compiles the TS code to JS and executes it => The compiled code is cached.

Permissions

A Deno app has no permissions by default, unlike NodeJS which has unlimited permissions by default.

With deno, this will compile but won't run with the regular deno run command:

const text = "My text should be stored in a file";

const encoder = new TextEncoder();

Deno.writeFile("text.txt", encoder.encode(text)).then(() => {
    console.log("Wrote to file :)");
});

You need to use security specific flags on your deno run command.

The above code will work with:

deno run --allow-write=text.txt app.ts

Deno Features

  • Deno Namepace APIs (built-in utilities)
    • No imports or installations are needed
    • Stable
  • Standard library (maintained by Deno team)
    • Needs to be imported into scripts to be used
    • Might be unstable
    • Builds up on core, low-level functionalities
  • 3rd party libraries
    • Needs to be imported into scripts to be used
    • Stability differs
    • Builds up on core, low-level functionalities

Download Details:

Author: AppliNH

Source Code: https://github.com/AppliNH/denotebook

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings