Deno

D

Deno

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

Join

how convert file to another format?

I’m playing with openai in deno using openai_deno and I’d like to know to convert an ogg file to whisper’s supported formats. First of all, the ogg files are from remote links and I use the native fetch api to get their contents then I use ‘new Blob([data.buffer])’ to transform the fetch file into blob. I even added ‘{type: ‘audio/wav’}’ but whisper still rejected the format...

WebSocket subprotocols

This might be a bug: Deno's websocket implementation seems to have issues with subprotocols (RFC section on subprotocol). I was using one initially, then I removed it and that issue seems to be resolved. With the subprotocol, since the one returned by Deno.upgradeWebSocket does not include the sec-websocket-protocol header, and response headers are immutable, I was instantiating a new Response instance, copying over data from the response returned by upgradeWebSocket and adding the sec-websocket-protocol header. Even then, the websocket in Deno never opened and all of its properties including readyState would remain undefined indefinitely. The browser was happy, though: its websocket instance's open event was firing, only the server never could use its websocket instance. I removed the subprotocols parameter to the websocket constructor and the code on the server handing it and now the server's websocket is opening and messages are flowing. ...

How can I create a linked [ReadableStream,WritableStream] pair?

Hi, I have a function A which accepts a WritableStream and another function B which accepts a ReadableStream. How can I plug them into each other so that the writes from function A will be given to function B? In NodeJS this could be accomplished with an NPM package like https://github.com/indutny/stream-pair....

how to use esbuild_deno_loader for local file?

i have [join(tmpDir, './bundle.js')] as entry point (resulting as string e.g. c:\Users\User\AppData\Local\Temp\tempdir-33c4f2f8\bundle.js, but that gives me a Do not know how to load path error on console? what am i doing wrong?...

Date-fns typings don't work?

I'm trying this code: ```typescript import { startOfDay } from "https://esm.sh/date-fns@2.29.3"; ...

window variable in fresh islands

How do I access window in islands? I need to modify DOM code client side.

Warning Implicitly using latest version (0.178.0) for...

Hello - Deno newb here. When running deno task start I get "Warning Implicitly using latest version (0.178.0) for https://deno.land/std/node/events.ts" The error below is then thrown which makes sense because https://deno.land/std@0.178.0/node/events.ts is a 404. `error: Uncaught (in promise) TypeError: Module not found "https://deno.land/std/node/events.ts"....

How to prevent std/http from gzipping and overriding Etag

It appears deno std/http applies gzip content-encoding magically sometimes depending on the type of data served. This is unexpected to me, will override manually set Etags with a weakly validated one, and it seems there is no way to disable this behaviour. Or is there? If I create a Github issue about this, should it go to deno_std or does this behaviour come from underlying http impl code in deno core?...

Fresh in a Docker exiting process

Not sure whats going wrong. Works fine on deno deploy. But when trying to run it inside a docker container the process exits shortly after starting. https://github.com/Robspin/deno-fresh-blog ...

eval script with stricter permissions in deno

Hi all, I wanted to know if its possible to eval a script in deno with more strict permissions. Something like vm.runInNewContext in node. At best, I think I can use Deno.Command('deno', {args: ['run', 'user-script.ts']}) right now. However, that means allowing any deno process to be ran at any time from the parent script. I am wondering if there is any way to specifically run a script with a subset of the permissions allowed to the parent script

solid-js with Deno

I was wondering if it was possible to use solid-js with Deno natively without something like esbuild. This is possible with react (with no config): ```tsx import * as React from "https://esm.sh/react@18.2.0" function MyComponent(props: {name: string}) {...

Feature Suggestion: Dark Mode for `std` library Docs.

Deno's documentation is great. I find myself reading it more and more. I currently use a browser addon called Midnight Lizzard to turn it Dark. It works great but since Deno's site is made in Tailwind I was wondering if the devs could add a simple Light/Dark Toggle button on Top Right of the page where you usually see them. It would be great on the eyes for long reads and overall.

Running esbuild with esbuild_deno_loader

I've spent probably four or five hours trying to track down this issue, to the point where I actually started tweaking and rebuilding old versions of esbuild to try and reproduce this bug without the help of a plugin. I have no idea. I want to find what version this started happening in to file a bug report (because I think it's an esbuild issue), but I haven't had the time to do that. Here is the reproc code (it only errors with wasm): ```ts import * as esbuild from "https://deno.land/x/esbuild@v0.15.10/wasm.js";...

`fetch` request always fails once

Hello, I got a script containing a fetch request. Once in a while, it throws the connection closed before message completed error. But always works at the second and next attempts. How's that possible ?...

Sequentially write to TPC connection

Hey, I experience errors when multiple async functions write to a TCP (Deno.Conn) connection. How can I make sure my data is sent fully, even if it can't be written to the send buffer in one function call? Using this code, I observed data (buf) being written partially, then data from other async functions being written before the remainder of the partially written data is written. ```...

Deno process watcher. How?

This code when compile, runs a simple http server.
import { serve } from "https://deno.land/std@0.178.0/http/server.ts";
serve((_req) => new Response("Hello, world"));
import { serve } from "https://deno.land/std@0.178.0/http/server.ts";
serve((_req) => new Response("Hello, world"));
...

monaco-editor on fresh

Hello. First of all, I am a newbie in web development. I played around with Deno for a while. So I thought I will leverage it to finally get into web development via Fresh. For a toy project, I am trying to build a code playground (like, https://play.yew.rs). I want to use monaco-editor(https://www.npmjs.com/package/monaco-editor). But monaco-editor works with HTMLElement (https://microsoft.github.io/monaco-editor/docs.html#functions/editor.create.html), instead of Preact. I could make it work as a static code(https://github.com/rnbguy/fresh-playground/blob/264e11813d549fe91b7bf2be38b454610bc5c676/components/Playground.tsx), but I need to add code in the island components to get the value from the editor using monaco API(https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.ICodeEditor.html#getValue) here - https://github.com/rnbguy/fresh-playground/blob/264e11813d549fe91b7bf2be38b454610bc5c676/islands/Run.tsx#L12....

deno in Dockerfile

i have successfully installed deno with theese commands: ``` install denojs RUN curl -fsSL https://deno.land/x/install/install.sh | sh ENV DENO_INSTALL /root/.deno...

could not find npm package for

I'm trying to make Hardhat CLI work with Deno but I stumbled upon this error which comes from Deno: I initialized a new hh project pnpx hardhat init then installed hh as a deno binary: ```sh...