Questions tagged [deno]

A secure runtime for JavaScript and TypeScript.

Deno is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

  • Secure by default. No file, network, or environment access, unless explicitly enabled.
  • Supports TypeScript out of the box.
  • Ships only a single executable file.
  • Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
  • Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno deno.land/std
919 questions
16
votes
3 answers

How to pull typings in Deno

I am checking out Deno and have found one of the starter examples very elegant: import { serve } from "https://deno.land/x/std@v0.2.10/http/server.ts"; const s = serve("0.0.0.0:8000"); void async function main() { for await (const req of s) { …
Tomáš Hübelbauer
  • 9,179
  • 14
  • 63
  • 125
15
votes
8 answers

How to Install Deno on Ubuntu

The command I run is: curl -fsSL https://deno.land/x/install/install.sh | sh The output is: ######################################################################## 100.0% Archive: /root/.deno/bin/deno.zip inflating: deno Deno was installed…
Parth kharecha
  • 6,135
  • 4
  • 25
  • 41
14
votes
5 answers

Deno: How to substitute npm scripts (package.json)

Since it is not necessary to have package.json file with deno, how can I as a developer have a similar experience just as we have with npm scripts in package.json?
CeamKrier
  • 629
  • 7
  • 15
14
votes
1 answer

How to run a Python Script from Deno?

I have a python script with the following code: print("Hello Deno") I want to run this python script (test.py) from test.ts using Deno. This is the code in test.ts so far: const cmd = Deno.run({cmd: ["python3", "test.py"]}); How can I get the…
14
votes
7 answers

Creating a Deno https server

I am looking for an example of creating a https server in Deno. I have seen examples of Deno http server but not https. I have tried searching in google but found no results
jayKumar
  • 141
  • 1
  • 4
13
votes
2 answers

How can I write files in Deno?

I was trying to write to a file using Deno.writeFile await Deno.writeFile('./file.txt', 'some content') But got the following cryptic error: error: Uncaught TypeError: arr.subarray is not a function at Object.writeAll ($deno$/buffer.ts:212:35) …
Marcos Casagrande
  • 37,983
  • 8
  • 84
  • 98
13
votes
1 answer

What's Deno equivalent of Node.js Buffer.from(string)

How can I convert a string to a buffer? I tried: Uint8Array.from('hello world') but it isn't working
Juan Carlos
  • 318
  • 2
  • 9
13
votes
4 answers

Is there any way to convert a Node project to Deno?

I want to convert a Node.js project to Deno. Is there any guide available? My current project has lots of NPM files and it's already in TypeScript. Any tips?
jotafeldmann
  • 642
  • 10
  • 17
12
votes
3 answers

deno import lodash from deno.land/x

I haven't been able to find the right syntax/URL to import Lodash in a Deno program. I tried this: import _ from 'https://deno.land/x/lodash@4.17.19/lodash.js'; That gives the error "Uncaught SyntaxError: The requested module…
Mark Volkmann
  • 909
  • 12
  • 15
11
votes
2 answers

How to console.log without a newline in Deno?

How do I print a new line to the terminal without a newline in Deno? In node.js I used to do: process.stdout.write('hello, deno!') Is this possible in Deno? Deno does not have the process module, and I could not find an equivalent option in…
wcarhart
  • 2,685
  • 1
  • 23
  • 44
11
votes
2 answers

How to import a module inside the Deno REPL?

Attempting to import a module in the Deno REPL results in the following error: Uncaught SyntaxError: Cannot use import statement outside a module at evaluate (rt/40_repl.js:60:36) at replLoop (rt/40_repl.js:160:15) I use the Node REPL to…
darksinge
  • 1,828
  • 1
  • 21
  • 32
11
votes
1 answer

How to get the output of a command in Deno?

For example, suppose I have the following code: Deno.run({cmd: ['echo', 'hello']}) How do I collect the output of that command which is hello ?
Wong Jia Hau
  • 2,639
  • 2
  • 18
  • 30
11
votes
1 answer

How to make HTTP client requests with Deno

I'm playing around with Deno but I can't find the standard HTTP client. I also googled "deno http client" which gives me https://deno.land/x/std/http/client/, but the link is broken. Something was indexed by Google and later removed from the…
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
10
votes
2 answers

How can I download big files in Deno?

I'm trying to download a 10GB file, but only 4GB get saved to disk, and memory is growing a lot. const res = await fetch('https://speed.hetzner.de/10GB.bin'); const file = await Deno.open('./10gb.bin', { create: true, write: true }) const ab = new…
Juan Carlos
  • 318
  • 2
  • 9
10
votes
5 answers

Can i migrate my Node based project to Deno?

Hello I am a frontEnd developer. First, I don't know much about the runtime environment. Is it possible to convert my project into Deno with Node? Even if I change all of my code, I'm not sure if the libraries I've received can run in a Deno…
KimMinJae
  • 135
  • 4
  • 10
1
2
3
61 62