Deno

D

Deno

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

Join

How can I let my program keep running even if it receives SIGINT?

I succeeded to write a program to handle SIGINT using Deno.addSignalListener("SIGINT", ...) API, but Deno always exits when it receives a SIGINT whether I put Deno.exit() inside the signal handler or not. [Edit: It was my mistake. Deno keeps running if a signal handler was registered.] I just want my program to reload the configuration file instead of terminating when it receives SIGINT. Is there any way to do it?

How to disable deno linter for whole project directory?

I'm using deno with mixed project folders, some use Vue and shouldn't be linted by deno. How do i disable it for the project folder?

How can I get `npm` in the path for Deno.run()?

I'm writing a script to automate a tedious npm task that I run frequently. When I use Deno.run() it says that it can't find the program (see the screenshot). How can I get the npm executable in the scope of the Deno process? I'm using: - Windows 10 - Deno v1.29.4...

error: The source code is invalid, as it does not match the expected hash in the lock file.

```bash ➜ deno task start Task start deno run -A --watch=static/,routes/ dev.ts Watcher Process started. The manifest has been generated for 3 routes and 1 islands....

Use Deno.run() to communicate with Arduino

Hey I'm trying to communicate via USB serial with my Arduino. My goal is to have the result I get via USB serial available as a variable in Deno. I tried to do the whole thing with Deno.run(). This is my Arduino main file: ```ino #define POTENTIOMETER_PIN_A A0...

Best place to host server side Deno App

I have a server side app I want to host in a specific region and I only want 1 instance of it running at a time, so deno deploy is not really right for this. Are there any other hosting services that are deno friendly?...

Morgan logger alternative in deno?

Hello 👋 What are you using to log http requests in your APIs? For example I'm using morgan in nodejs but I'm wondering what's the best alternative in deno that is actively maintained 🙂 Thanks in advance!

NPM Import missing types

Playing around with some deno code and testing a npm import, the original package has types (redaxios) although when I import it it's not showing any intellisence in VS Code

Update value by reference without duplicating the data

Im exploring the world of FFI, porting some C applications I have to TypeScript, with the help of Deno. Currently, I cannot think of an efficient way to update the value that a pointer is pointing to. For instance, in C I could do something like: ```c char *array = calloc(2, sizeof(char)); if (array == NULL) return 1; *(array) = "hello";...

how to hash very large files

We have deprecated the old std/hash code in favor of the crypto module, but I do not know what the standard approach to hashing something piecemeal looks like. The advice around the crypto digest generally looks like this: ```ts async function crypto_hash(filepath: string) { const file_buffer = await Deno.readFile(filepath) const hash_buffer = await crypto.subtle.digest('SHA-256', file_buffer)...

xstate - no types imported

import * as xstate from "https://deno.land/x/xstate@xstate@4.35.2/src/index.ts"; file is cached, yet no types (restarted language server ext.) any ideas?...

example of kysely running on deno deploy?

Deno Deploy awesomely can connect to postgres directly from the edge https://deno.com/blog/deploy-postgres-at-the-edge so I was hoping to use https://github.com/koskimas/kysely#deno Was trying to make it work like this: ``` import { Pool } from 'https://deno.land/x/pg@v0.6.1/mod.ts'...

[react] document is not defined

the following code returns document is not defined. i have no idea how i'd go about fixing this. the example uses next.js' dynamic() but i'm doing this in "plain" react. any ideas? thanks! ```ts import { NotionAPI } from "https://esm.sh/notion-client@6.15.6"; import { NotionRenderer } from "https://esm.sh/react-notion-x@6.15.7"; ...

Updating digest with web crypto

For some context, I'm updating some code that was importing from std/hash (specifically std/hash/sha256) to use std/crypto since the hash submodule is long gone. I've run up against a case where I'm not really sure what I should do to move forward. The code looks something like this: ```typescript const digest = new Sha256()...

react-notion-x usememo error?

i'm using react-notion-x, following the get started prompt and frankly i'm not sure what's wrong. useMemo is a hook, but i'm not sure what i can do differently to make it not produce this error

What would be the best third party module implementing `deflate()`?

Currently using npm:pako but I'd like to avoid npm specifiers (modules in general).

Pass string to struct FFI

Quick question about Struct-Value feature, what would be the best way to pass *const u8 (or strings) to structs? I am kinda lost after reading the tests to get some examples running, here's what I got working so far : ```ts const lib = Deno.dlopen("./target/debug/libtest_struct.so", { add: {...

module augmentation

Suppose module.ts is some external module that I have no control of. In my file test.ts I want to change the type UserEnv of the external module. How can I do this or does Deno just not support this and you basically need to use node to do this? ...

deno blog without html sanitization

I want to be able to javascript Canvas API things in my blog - surely this is possible?