Deno

D

Deno

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

Join

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?

adding async data to array?

i'm probably missing something obvious but i'm trying to add data that's async to an array in a forEach loop. below is my code: ```ts const posts = await notion.databases.query({ database_id: Deno.env.get("DATABASE_ID"),...

How add custom colors to twind config?

my config: ```ts import { Options } from "$fresh/plugins/twind.ts" export default {...

How deploy deno.fresh project for my VPS?

Hi I try setup fresh project: https://mint-house.app/ http://5.187.7.221:8000/ is there a task in fresh to generate static files ?...

Killing subprocess not working

Anyone know what I'm doing wrong when trying to kill a process? I have a process start another process like this: ```ts runProcess = Deno.run({...

Looking to chunk the HTML stream on the homepage to reduce initial page load. Are there good docs?

I'm currently reading and transforming every markdown file in the render function and i'd like to instead yield chunks of markup so the browser can get started rendering sooner. is there a paved path for me in fresh? thanks!

Rewind streams

So I'm using web streams (byob) for a project but in some cases I need to peek ahead. Is it possible to do this with webstreams? I want to read a static amount of bytes and then rewind by n bytes (between 0 and 4)...