spirobel
spirobel
Explore posts from servers
DDeno
Created by it's em! on 1/29/2024 in #help
How can I flush a stream to a response?
nvm had to add { headers: { "content-type": "text/html; charset=utf-8" } } and now it works
7 replies
DDeno
Created by it's em! on 1/29/2024 in #help
How can I flush a stream to a response?
is there are full working example? cant get my deno to flush 😳
7 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
(while sending the Hello instantly) EDIT: with { headers: { "content-type": "text/html; charset=utf-8" } } it works
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
it waited 5 seconds and then sent the whole Hello world. I thought it would send Hello, then wait for 5 seconds and then send the world! 😀
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
is there something special I need to do to flush the buffers after every yield? I tried this:
javascript
Deno.serve(
(request) =>
new Response(
ReadableStream.from(makeStream(request)).pipeThrough(
new TextEncoderStream()
)
)
);
const wait = (n: number) => new Promise((resolve) => setTimeout(resolve, n));

async function* makeStream(request) {
yield "Hello,";
console.log("start wait ");
await wait(5000);
yield "world!";
}
javascript
Deno.serve(
(request) =>
new Response(
ReadableStream.from(makeStream(request)).pipeThrough(
new TextEncoderStream()
)
)
);
const wait = (n: number) => new Promise((resolve) => setTimeout(resolve, n));

async function* makeStream(request) {
yield "Hello,";
console.log("start wait ");
await wait(5000);
yield "world!";
}
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
thanks a lot for your reply! I didn't know yielding buffers or strings mattered. this is great info!
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
No description
9 replies
DDeno
Created by spirobel on 2/25/2024 in #help
How to feed a ReadableStream / async Generator into a Response object?
another try using the node:stream Readable. works in bun does not work in deno
9 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
yes. I run a bun run build in a github action. I think I could define createRequire during the build process. https://www.npmjs.com/package/create-require but unsure if it is worth the effort. Is there a plan to catch up with deno / bun when it comes to node compatibility?
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
with deno it works. they support the node:module thing. So I can use the target node to bundle my backend and deploy it to deno. or self host. It would be nice to also deploy it to cloudflare workers. But that would mean I would have to switch to target browser and that means I would have to rewrite many things. Would it be possible to use the wrangler bundler on top of the already bundled package that was bundled for the node target?
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
node:module is not supported in cf workers, right?
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
my example looked something like: import { entryPoint } from "../dist/bundledwithbunthing.js"; import process from "node:process"; import { Buffer } from "node:buffer"; just the import statement at the top while still lead to the error message
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
I think I found the issue: I use bun to build a package with target: "node" and it adds this to the bundle:import{createRequire as Ff} from"node:module"; just importing this package is enough to trip up wrangler
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
lets take a look if it makes a difference
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
ohhh and wrangler as a dependency instead of dev dependency
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
that looks like this
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
name = "experiment-worker" main = "entrypoints/cf.js" send_metrics = false compatibility_flags = [ "nodejs_compat" ] compatibility_date = "2024-01-29"
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
and i have a wrangler.toml
22 replies
CDCloudflare Developers
Created by spirobel on 2/18/2024 in #workers-help
nodejs compat mode problem: Uncaught Error: No such module "node:module"
i didnt use the -j
22 replies