Repository navigation
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
|
Answered by
sindresorhus
Feb 17, 2021
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