Deno

D

Deno

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

Join

FFI: How to pass a pointer to a char pointer?

How can I pass a pointer to a char pointer in order to use the C function below via FFI?
my_func(char **strp)
my_func(char **strp)
The external library is supposed to write a string to that buffer, and then Deno reads its content...

Deno.serve().shutdown doesn't exist?

```ts const server = Deno.serve({ hostname, port, })...

Deno deploy see error

How can i see the error why my build failed? It just returned Error An internal server error occurred. not much to see why it failed

In-browser testing

I need to run some tests in a browser (Chrome, Firefox, Safari). Either by running a full test suite in the browser (ideally I like to run the suite in Deno too) or by connecting to and automating the browser, doesn't really matter. I'd really like to do this from Deno, and not have to go back to some node test framework. Can anyone suggest anything related that they've had success with in Deno?...

Cannot pass request object to worker

I am trying to pass a request object to a worker file, but it is not receiving it inside of the worker, for the worker to process
I can post my code if this question is not clear...

Does the picture plugin for lume work with remote Images?

I want to use the picture plugin with images that are from a remote location. Is there a way to get remote files working with the picture plugin?...

problem with prompt on windows

Hi, I'm experiencing trouble when inputting 2 char long strings in prompt, it's doing \r...

Duplicate tailwind classes in Fresh project

Across the board I'm seeing tailwind classes duplicated in my Fresh project. There doesn't seem to be any harm from the user's perspecitve in terms of things laying out differently, but this does make debugging more annoying and sends needless markup to the client. Has anyone else seen this? Thanks in advance! ```...
No description

Trouble accessing Deno KV via the Deno CLI

I'm trying to connect to a Deno KV via the CLI with the following simple code: ```ts //main.ts const kv = await Deno.openKv(...
No description

Best way for application config in deno/ts?

Hi. I'm alex and quite new to deno/typescript. Thank you for the quite big documenation it is a quite good starting point 🥰 I have created a upload module for caddy server ( https://github.com/git001/caddyv2-upload/ ) and try to "port/migrate/redevelop" this in typescript. Sorry for the long first post, but I'm not sure if this is the right forum, if not please redirect me to the right one 🙂 . As you may have seen I have a test upload question already asked on gh ( https://github.com/denoland/deno/discussions/20983 ) which was answerd and I was able to make a upload via curl. Now to start a more useable programm I have some newbie questions an hope to get here some answers or pointers from which I can start to learn. What's the best way to configure a Application, something similar to https://github.com/git001/caddyv2-upload/blob/main/docker-files/opt/webroot/config/Caddyfile which puts the data into this struct https://github.com/git001/caddyv2-upload/blob/main/upload.go#L29-L51 . What I have learned from ( https://www.typescriptlang.org/docs/handbook/ ) is that typescript is a typed js so maybe there is such something similar like the struct in go....

Error trying to connect: Connection reset by peer (os error 104)

Hello, i'm trying to deploy a my Fresh website using a Ubuntu 22.04 server but when I try to run my code (using deno run main.ts -A) I get this error
error: Import 'https://deno.land/std@0.193.0/dotenv/load.ts' failed: error sending request for url (https://deno.land/std@0.193.0/dotenv/load.ts): error trying to connect: Connection reset by peer (os error 104)
at file:///home/mysite/main.ts:7:8
error: Import 'https://deno.land/std@0.193.0/dotenv/load.ts' failed: error sending request for url (https://deno.land/std@0.193.0/dotenv/load.ts): error trying to connect: Connection reset by peer (os error 104)
at file:///home/mysite/main.ts:7:8
...

Deno.test without Deno namespace ?

Hi there, Does someone know if it's possible to run a test from Deno.test without the Deno namespace ? I tried using a workaround by using Web workers and performing a delete self.Deno which does work but... stumbled upon this issue https://github.com/denoland/deno/issues/13206 . So while I can perform my tests, now I can't get the code coverage since web workers don't collect it....

WASM / Extract and manipulate Array of Date

I try to extract and manipulate an array of date in a function The rust fn doesn't compile. How to manipulate Date and convert it ? Does someone have a repository/link with example of Rust + Deno library ?...

error: Uncaught Error: Input watch path is neither a file nor a directory.

Im encountering a weird error when I run a code in Windows that was initially created in a OSX. It still runs fine in OSX, but in windows its shows the following error (synced through github): ```js error: Uncaught Error: Input watch path is neither a file nor a directory....

ES Module mocking workaround

Hello all, I've been using Deno and Fresh for the past few weeks on a personal project and I love it. My only issue I have is testing. Basic testing on routes and pages is fine but I am having issues mocking 3rd party ES Modules such as mocking out my getSessionId function from kv_oauth . I've tried using Sinon and Deno's stubs but I haven't had any luck, would people recommend using a deno or npm tool to convert to CommonJS just to mock in tests is there a better way of doing this? Happy to provide more info or examples if needed, thanks! 🙂...

FontAwesome Import into island component not working as expected

Hey, I want to use FontAwesome with a Fresh component inside my island folder. I followed the following FontAwesome setup: https://fontawesome.com/docs/web/use-with/react/ I'm using Babel Macros for the setup as explained here: https://fontawesome.com/docs/web/use-with/react/add-icons...

KV - Not possible to maintain in real world?

I have a question regarding Deno KV: I just checked the docs and it seems straight forward so far BUT since it is not possible to query for values or let the DB itself create secondary indexes I wonder how the real world workflow could look like? - If I want to query a single value of a huge object, I need to retrieve the full object if I didnt save them as secondary indexes before. - If I want to query for a specific value of a huge object efficiently, I need to create secondary indexes. But what if I need a new query for a new feature that I develop? Now I need to create new secondary indexes for all existing values before I can do this query? At what point in my application should I add them? On startup? Or should I write a migration script each time I want to add a new query? - What if I have 1 million users and I have implemented a findByMail() function by creating secondary indexes for all million users, but one day I dont need the findByMail() function anymore. Now I have 2 million database entries from which 1 million are unused. At what point in my application do I delete them? On startup? I need a migration script each time I want to remove a new query?...

Get a Parameter Value in Oak

so if I set up a router like this
router.get("/:id", (ctx) => {/*handle router context*/})
router.get("/:id", (ctx) => {/*handle router context*/})
then how do I get the value of the id parameter? I have tried ctx.id and it did not accept it