Deno World
Published in

Deno World

Deno REPL

Most of the languages, runtimes, etc. comes with a REPL that can be used to quickly write statements, run them, and check the output. Here is the definition of REPL from Wiki:

A Read-Eval-Print Loop, or REPL, is an environment where user inputs are read, evaluated, and the results are returned to the user. REPLs provide an interactive environment to explore the language/runtime without writing a program, saving, and running it on the shell. Some examples include the Node.js console, IPython, the Bash shell, and the developer console found in most web browsers.

Deno is no exception. It comes with a fully functional REPL. In this article, we’ll see some examples to learn Deno REPL in detail.

Getting started

To start REPL, simply run deno without any subcommands:

Deno REPL runs with all permissions

Simple JS operations

Any JavaScript/TypeScript operations, console logs, etc. can be used within REPL.

File I/O

Files can be read or written to.

Making HTTP request

The fetch API can be used to make HTTP requests.

HTTP server

An application with dependent modules can be directly pasted into REPL. Deno will download the dependencies and compile the dependencies.

Process details

A REPL is a regular Deno process. We can get things like PID, PPID, memory usage, etc.

Interactive

An interactive code takes the user input and prints it back.

Random data

A random UUID can be generated using crypto’s randomUUID function.

That’s all about some use-cases of REPL.

This story is a part of the exclusive medium publication on Deno: Deno World.

--

--

--

The one and only exclusive medium magazine with 200+ articles on Deno

Recommended from Medium

How to Host an Angular Application on Firebase

Learnings From Forking an Open Source Project

WebAssembly, Native Code in Browser

How to Check if the Type of a JavaScript Variable is Boolean?

Best of Modern JavaScript — Arrow Function Syntax

Some tips to use ViewModel+LiveData

How to Make a Photo Editor with Vue.js

Deno nuggets: Oak middleware to measure response time

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
Mayank Choubey

Mayank Choubey

Deno, Node.js, etc.

More from Medium

3 ways of accepting self-signed certificates in Deno

Running Deno in Docker

Deno nuggets: Simple hello world server

Deno by example: Content server — Part 5 Logging, tracking & documenting