Deno

D

Deno

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

Join
max
max5/18/2024

Deno.serve: Is it possible to flush a streaming response?

I've been playing around with this: https://docs.deno.com/examples/http-server-streaming I am coming from Go and I'm used to having the functionality to flush the http response to the socket. Allowing lots of control over when bytes are sent over the wire (like so: https://robpike.io/) Is there any mechanism to prompt deno to write to the socket? Maybe another streaming response type?...
numberkruncher
numberkruncher5/17/2024

How to mock modules like you can with jest?

With node/jest I was able to mock specific functions from modules using jest.mock at the start of the test file. How can I do this in Deno? I have a module which calls a function from another module: ```ts import {foo} from "foo"; export function bar(a: number): number {...
saeho
saeho5/17/2024

Should I be using memo() in Fresh (/components/ folder)?

If Fresh renders the files in /components/ folder as html, and returns no javascript, should I ever bother using memo() in anything inside the components folder?
Jawad
Jawad5/17/2024

How to use new FormData constructor in Deno server, I want to use it for my supabase edge function.

I've created an edge function in supabase that requires formdata,I know it's a browser side thing and also supports in latest node version. But when I use this in deno , such as
const formData = require(form-data)
const formData = require(form-data)
it gives an error after deployment , it says require is not defined. But if I use
const formData = new FormData()
const formData = new FormData()
...
davecancode
davecancode5/17/2024

How to import qstash into deno edge function?

Hi, simple question, I think, but I can't figure out. I want to import this module into my deno edge function so I can use the Client and Receiver in some webhooks for background jobs: https://deno.land/x/upstash_qstash@v2.5.2 I can't get the import to work. Not sure if it requires an import map or I can just declare it at the top of the edge function file in typescript....
saeho
saeho5/16/2024

Deno Fresh: client side check dev or production

For my Deno Fresh app, I want to do a simple check from the client-side code to see whether it's in development mode or production deployed mode. Use case is: I want to point my API to my localhost if it's in development, otherwise point the API to production server. How can I do this in Deno Fresh?...
Dezz
Dezz5/16/2024

Websocket

Hey, which does anyone know a good framework/api for mobile app websockets for deno?
saeho
saeho5/16/2024

Deno is not defined

Is "Deno" supposed to be defined on the front-end client? I'm trying to get a simple app working using Fresh framework, but even on a fresh install of Fresh app, Deno is not defined in client, which causes a LOT of necessary Deno modules to not work (for example, "graphql-request"). Is this a bug on Deno? Or is there another way I'm suppose to do this?...
jcayzac
jcayzac5/15/2024

shebang and no file extension: how do I turn Typescript on?

I have scripts with a #!/usr/bin/env deno run shebang, but they execute as javascript —adding types lead to parsing errors. Can I enable typescript with a command line parameter to deno run?...
martpet
martpet5/14/2024

Why cannot use emoji in variable name?

The module's source code could not be parsed: Unexpected character '💿' at file:///Users/
zimbo
zimbo5/14/2024

caching known dependencies on devcontainer startup

👋 after setting up an ubuntu devcontainer with deno and the vscode extension installed, is it possible to cache the dependencies in import_map.json on startup? i've tried adding deno cache as a post* command and in Dockerfile but find that nothing happens as post* steps and Dockerfile errors with an unfound file or doesn't work from the correct directory: ```...
denyncrawford
denyncrawford5/13/2024

libp2p crypto error - Not implemented

Version: Deno 1.43.3 I'm trying libp2p on deno and i'm getting this error from the crypto package: Is there a way to solve this? like replacing the module in the importmap or something?...
No description
Auteur
Auteur5/13/2024

My Website hosting just stopped working randomly

I'm using qwik framework and deno deploy. My website was hosted just fine on www.morningharwood.com and randomly it stopped working w/o any config changes. error seems very weird: This site can’t be reachedCheck if there is a typo in www.morningharwood.com. If spelling is correct, try running Windows Network Diagnostics. DNS_PROBE_FINISHED_NXDOMAIN...
Max
Max5/12/2024

Deno package management questions.

I have a few questions regarding package management in Deno. 1. Here Deno documentation states that import maps are only applied to applications, and that library authors should prefer the deps.ts pattern. Contrarily, the jsr documentation specifies that a dependency manifest like the import map in the deno.json file can be used by a library. Does this mean that the deps.ts pattern is now obsolete?...
Yrand0-Gaming
Yrand0-Gaming5/12/2024

i have a rpi armv6 but i cant install deno. is it cause of compatibility issues

i have a rpi armv6 but i cant install deno. is it cause of compatibility issues
WingZer0o
WingZer0o5/12/2024

Postgres Deno Connection Pool Idle timeout

I am using NeonPostgres and connecting to the database in Deno using the following below and executing this way. This connection is running in a Discord bot using Discordeno. I am entirely ruling out local network setup however the discord bot itself never disconnects. So that brings me here. After a certain time frame that I haven't determined quite yet. Maybe 20 minutes or so? ```typescript import { Pool } from "https://deno.land/x/postgres@v0.19.3/mod.ts"; ...
anggoran
anggoran5/11/2024

Managing Test Scripts

How to manage multiple test scripts so they will be detected on the Test Explorer?
Phatso
Phatso5/10/2024

Websockets API with async processing (is there a better way?)

My Deno app has a websockets layer that receives "requests" from the websocket clients. The clients ask it to update data in the database, retrieve data, etc. similar to a REST api There will be 5-10 clients who will be sending a very large volume of requests. ...
eirikb
eirikb5/9/2024

deno_core as JS sandbox

(repost from genreal) Hi. I'm making a service where I let users run JS in a sandbox. I'm currently using the isolated-vm npm package. Would running deno_core be harder, better, faster, stronger? I don't need much and a know a bit of rust. Current implementation has no modules, but built in JS things like setTimeout, and async/await works. I also inject a custom fetch method. And I have a timeout....
Tanmay (तन्मयः) たん冥
Tanmay (तन्मयः) たん冥5/9/2024

Can you use deno fresh on deno deploy playground?/

@Deno AI Helper Can you use deno fresh on deno deploy playground?/
Next