jcayzac
Explore posts from serversshebang and no file extension: how do I turn Typescript on?
I have scripts with a
#!/usr/bin/env deno run
shebang, but they execute as javascript —adding types lead to parsing errors.
Can I enable typescript with a command line parameter to deno run
?3 replies
How to build a Response object with the 'url' property set
Writing unit tests. Some functions parse Response objects. How do I create some where the
url
property isn't an empty string?
Crafting statusText
and headers
to mimick a server response from a certain host doesn't seem to work.4 replies
Using "imports" in deno.json doesn't work in VS.code
* deno 1.38.3
* vs.code 1.84.2
* denoland.vscode-deno 3.28.0
I got rid of my import map and moved the
"imports"
directly into deno.json
, as supported since 1.30.0
.
Deno works fine, but the VS.code extension is now broken and complains about the missing import map on each of my local import { … } from "@/foo/bar.ts"
.14 replies
Migrating from EventEmitter…
Hi! I've got some legacy code that depends on
node:events
's EventEmitter
class, specifically its once()
method that returns a promise resolving the next time a specific event arrives, as well as removeAllListeners()
. What would you suggest I use to get rid of that dependency? I can't use EventTarget
since it doesn't let you drop all the registered listeners and doesn't support the once()
scenario. Anything else?5 replies
Most efficient way to broadcast messages globally across main script and workers?
I basically want a simple message bus that is global to all my workers + the main script, without relying on any dependency.
Is there something more efficient, maybe using MessageChannel, than using postMessage() in workers to send things to the main script and iterate through all workers in the main script to postMessage() again on each worker?
20 replies
std/http/server: URI too long —how to avoid loading those?
Using https://deno.land/[email protected]/http/server.ts, is there a way to reject long URIs before they are loaded in memory? I have a middleware that responds with
414 URI Too Long
when the URI length is > 8192, but this only saves me from the cost of parsing that thing —it's still already loaded in memory even if it's 1MB in size.
How can I get the server to close the connection when the URI grows beyond 8k instead?6 replies
How to recover from worker death? It terminates my main program…
In the error message handler, I replace the dead worker with a new one, but it kills my program either way.
Full repro & log at https://gist.github.com/jcayzac/48ae8304a6b3c790353c52f98e242904
Thanks!
5 replies