Deno

D

Deno

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

Join

File name conventions

Some of my .ts files are meant to be run from the command line. Some of them when imported do things (like read .env files) Is there a file naming convention for such things?...

split error when using std toml

here's the error: ``` $ deno run -A toml.ts error: Uncaught (in promise) TypeError: subStr.split is not a function const lines = subStr.split("\n");...

How to cancel or abort .pipeTo()?

I prefer not asking, but after I found (what I consider) an MDN easter egg, I realized this is probably not something I'm going to solve without help from runtime-implementers. https://user-images.githubusercontent.com/17692058/200146738-da3e8747-6c7f-4ec7-adb8-fbb8c8947d33.png The example is straightforward, call stream1.pipeTo(stream2) then, with full access to both stream1 and stream2 try to shutdown/cancel/close/abort/sabotage/nuke stream1, stream2 or even just the pipe itself (copy-paste example below). The big issue is that, because of the pipeTo the deno process never ends. I've tried absolutely everything I can think of, including inheriting from WritableStream, prototype pollution hacks, accessing probably-shouldnt-be-accessed-directly-symbol keys, etc and I've not got a hint of success ```js...

is it possible to change how tsx bundles to js?

So I’m wondering if it’s possible to get Deno to convert
<div class="test">Potato</div>
<div class="test">Potato</div>
to ```js { tag: "div",...

can't load external modules when run as child process with Deno.spawnChild

Hi! This is really weird, but I'm trying to run deno scripts under another deno process with Deno.spawnChild(Deno.execPath(), {...}) Problem is the subprocess deno is unable to load any remote dependencies (mongo here just an example, even std modules fail to load): error: Uncaught (in promise) TypeError: error sending request for url (https://deno.land/x/mongo@v0.30.0/mod.ts): error trying to connect: dns error: A non-recoverable error occurred during a database lookup. (os error 11003)...

turn off js with fetch?

i'd like to fetch only the html version of a website, if there is one. any ideas on how to do so?

Fresh fetch data in component

Hi I need help with Preact, I would like to do a fetch in a component using Handlers and then use that data in the same component without the component having props that would interfere with the parent component.

Supabase-slash-PostgresSQL ConnectionRefused Connection refused (os error 111) on Deno Deploy

I'm having issues with supabase on a couple of deployments, but not others using similar code (connecting to different databases, but all on supabase). The error is the same on both: ConnectionRefused: Connection refused (os error 111). The code and connection works fine from GitHub actions and from local. Any idea what's up? Supabase status is ok. I've asked for help in https://discord.com/channels/684898665143206084/826085979344470037/1037982322378690611 as well....

package to turn html into plaintext?

i want to try turning html pages into plaintext in the terminal. any ideas?

File line operations

Hello, How to perform the following file manipulations in Deno ? - Read the nth line...

FFI how to pass (or get) 128-bit bigints to (or from) Rust functions?

I want to pass bigints from Deno and get i128 or u128 in Rust. Do I have to use typed arrays for that?

Unable to view logs to debug edge function for Deno Fresh + Deno Deploy

Thanks for making Deno, and Deploy, and Fresh. I'm a huge fan. I'm building a feature to allow user-written scripts to run at the edge. I'm persisting these scripts on my 1998.social domain. This is my edge function that proxies that data to import and execute them. Visiting this edge function will load this object for the func attribute: the proxy-able edge function as a module export. The page errors with "An error occurred during route handling or page rendering."...

TypeScript enums

So enums are objects with all keys being values and values being keys. Most of the time when using enums though, I place a specific enum, so knowing exactly what the value will be there. Is there a way to instead of referring to the object to get to the value, it just hard codes the value when bundling from ts to js?

How to get complete Deno RAM usage?

Do we use Deno.memoryUsage().rss or should it be rss+heapUsed+external?

mongodb calls on DB's rather than collections

When I do a find on a mongoclient rather than a collection ``` clnt: MongoClient, ...

can i bypass strict mode?

When I try use Deno Run , it complains error: Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them const answer = o[s]; ...

piping for async sub process

In Deno.process, is there a way to set its STDOUT to something I can read line by line while that primary process is still running?

Deno NPM VSCode Intellisense

Is there a work around for this at the moment? I want to try out Deno's NPM support but I lose Intellisense when importing with npm:. I tried using an import map but that didn't work either. If there's a code editor or an IDE that currently supports this feature I would love to know.

Need help making fresh, rutt and preact base path aware

I'm currently trying to make fresh base path aware. I already patched rutt to work with base paths. It currently works pretty okay. Now I need help with preact as I have no experience with preact. Is there a way to tell preact to add a base path to e.g. all relative links? E.g.: <img src="/logo.svg" ... from the jsx file should be 'compiled' to <img src="/my_base_path/logo.svg" .... Or do we need to do this ourselves by adding a ${BASE_PATH} before all links? A mono-repo for this mess: https://github.com/wille-io/deno-fresh-rutt-baseurl...