Skip to content

Instantly share code, notes, and snippets.

@Guihgo
Created February 4, 2023 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Guihgo/457b6aef396d0247d389b4b62cea9b57 to your computer and use it in GitHub Desktop.
Save Guihgo/457b6aef396d0247d389b4b62cea9b57 to your computer and use it in GitHub Desktop.
Fetch to Stream Web Response
this.app.get("/webhook/test/google", (req: Request, res: Response) => {
fetch("https://google.com").then(r => {
r.body.pipeTo(new WritableStream<Uint8Array>({
write(chunk){
res.write(chunk)
},
close(){
res.end()
}
}))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment