Deno

D

Deno

Chat about Deno, a modern runtime for JavaScript and TypeScript.

Join

Deno hangs on error

Why does Deno hang when XML.parse throws an error? ``` let text = '<xml><xbrli:xbrl><hi>Hello</hi></xbrli:xbrl></xml>' import * as XML from "https://deno.land/x/xml/mod.ts"...

[SOLVED] deno.lock keeps getting populated with dependencies I don't need

I have tried to use a syntax highlighter before and have since removed it from my project, but every time I save any file, the deno.lock gets populated with these dependencies again, despite the fact that they are not used anywhere in my project. How can I make this stop?

What a method prefixed with `#` means?

This is perhaps the stupidest question ever. But I often see method with names prefixed with a # character in typescript. What does it mean? Google does not seems to know either. example: https://deno.land/std@0.187.0/streams/text_line_stream.ts?source#L40...

Logger names and prefixes

Is there any obvious way on how to configure std/log so that loggers named my-prefix/foo/bar and my-prefix/hello/world attach to the same handlers automatically? In other words, can I configure logger handlers based on logger name prefix?...

Deno and `npm:mongodb` problem with `node:`?

``` ❯ deno check --reload main.ts error: Relative import path "net" not prefixed with / or ./ or ../ and not in import map from "file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/mongodb/5.6.0/mongodb.d.ts" If you want to use a built-in Node module, add a "node:" prefix (ex. "node:net"). at file:///Users/.../Library/Caches/deno/npm/registry.npmjs.org/mongodb/5.6.0/mongodb.d.ts:29:29...

DiscordJS "Error: Not implemented: ClientRequest.options.createConnection"

```ts import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags, Client } from "npm:@discordjs/core@0.6.0" import { REST } from "npm:@discordjs/rest@1.7.1" import { WebSocketManager } from "npm:@discordjs/ws@0.8.3" ...

Using Superagent in Deno?

Has anyone managed to make Superagent work nicely in Deno? ``` _ { type: "error",...

Oak – ctx.assert with custom response headers

Am I doing this wrong? No extra custom headers are being set in the response as far as I can see in cURL: ```ts ctx.assert( !missingHeaders,...

npm:undici doesn't work

https://github.com/denoland/deno/issues/16710 Marked as resolved by this issue but does not work in my environment ```ts import { request } from "npm:undici"...

how to specify giving error or warning for a lint rule?

I'm new to Deno couldn't find a way to make a lint rule give error instead of error ```json { "lint": {...

Abusing prototype CryptoKey in `node:crypto`

Is there any way that I can set the prototype of an object to specifically CryptoKey as defined by node:crypto? I am trying to get around some nasty instanceof check in a third-party library which is getting in the way. ```ts import * as krypto from "node:crypto"; Object.setPrototypeOf(foo, krypto.webcrypto.CryptoKey.prototype);...

Async OP that returns value instead of promise

In deno_runtime is possible to have async op that returns the resolved value instead of promise? Kinda like calling tokio's block_on in the op (is it possible)? For my use case i use crate in that uses async but in js I use library that will call this op but it doesn't support async. I there any way to work around this problem?

VS-Code auto import local modules

Hey is there a way to enable some sort of auto import for local modules/files in VS-Code? Currently it only works if the file is opened in an other tab. When I close the tab an try to use autocomplete an exported module from that file it does not auto import. Is there a fix to this? Or some settings? Thanks for any help!...

In memory Deno Kv

Hi there, I am exploring with Deno Kv and it looks great! But my test are failing because I reuse the same database over and over. Is there a way to initialize an in memory version of Deno.Kv ? Something like sqlite in memory (https://www.sqlite.org/inmemorydb.html)?...

Deno Language Server Issue - Attempting to Use KV in Existing Project

Hi! I'm attempting to create a branch of an existing project (utilizing Fresh) and add KV as an experiment. I also just want to establish I do have the latest version of Deno installed and have updated VSCode/the Deno extension. While getting things set up, I updated my vscode folder in the project directory and also made sure to update deno.json to use the unstable flag. Upon trying to add a new file that utilized KV, I noticed I kept getting errors upon typing anything related to the new KV API. I suspected there was something off with the Language server, but upon inspection it seemed to recognize the unstable flag just fine. I decided to quickly fork the tic-tac-toe project referenced in the KV documentation to compare and contrast - it all works fine, even offering up tooltips mentioning that KV is unstable and how to use it. I compared Deno Language Server Status between the two projects, but could not spot a difference. The vscode directories in each project are basically identical....

Twitter API

Is there a easy way to fetch Tweets using Twitter API or something else? (since they put their API cost is 42$k+)

In browser video chat client & server

Hello! How might people go about architecting an in-browser video chat client & server, specifically wanting to stream the client's camera feed to a server I'm hosting. On the client side it seems I can use https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia to get the camera and audio streams. How do I go about piping those streams to the server in a performant way? Unless I'm totally off base, there isn't an in-browser API to send arbitrary UDP packets https://gafferongames.com/post/why_cant_i_send_udp_packets_from_a_browser/, so are websockets the best option here? On the server side are there good libraries to receive packets with video & audio data and relay them onto another client?...

File Permissions on Deno.FileInfo

Hello. As a programming exercise I'm trying to convert a Decimal number into Octal and that Octal representation into a Unix File Permission representation (drwx-). * I have a directory with the number 16877 -> 40755 * I have a file with the number 33188 -> 100644 ...