How to implement Promise chains/Streams? #21818
Unanswered
adhamsalama
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I already asked a question about how to implement setInterval here at the roll-your-own-javascript-runtime because I got no reply there.
I'm generally having trouble in implementing Promise chains, like implementing the Fetch API.
In JS, you can use fetch to make a request, await it, which will return status code and headers, then you can execute something like
let jsonResponse = await response.json()
to get the body.How to do that with Deno/Rust?
The tutorial implements a trivial fetch API that just fetches the entire response at once and returns it as text.
As far as I understand, that works in Node.js with Streams, but I still don't know how to bridge the gap between JS and Rust in this case.
I get that the tutorial is supposed to be simple, but it got me really interested in how I would implement this kind of stuff.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions