Created
February 4, 2023 04:23
-
-
Save Guihgo/457b6aef396d0247d389b4b62cea9b57 to your computer and use it in GitHub Desktop.
Fetch to Stream Web Response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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