Getting the body from a Got stream #1613
-
What would you like to discuss?After creating a const got = require("got")
const requestStream = got.stream("https://google.com") I found that to get the result buffer this needs to be done: const pEvent = require("p-event")
const getStream = require("get-stream")
const [result] = await Promise.all([getStream.buffer(requestStream), pEvent(requestStream, "response")]) Is there a simpler way to do this? Checklist
|
Beta Was this translation helpful? Give feedback.
Answered by
sindresorhus
Feb 17, 2021
Replies: 2 comments
-
You should be able to just do Line 58 in d0cd709 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
szmarczak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should be able to just do
const data = await getStream(got.stream(…));
.got/test/stream.ts
Line 58 in d0cd709