I have Node code that I honestly don't fully understand but AFAIK it streams and transforms the received data.
var download = got.stream(remoteURL, { isStream: true })
var resultTransform = new Transform({
transform(chunk, encoding, callback) {
..
}
return download.pipe(resultTransform, { end: true })
I want to do the same in the browser.
What I am trying is
var download = await fetch(remoteURL)
..
console.log(typeof(download.body))
// "ReadableStream {locked: false}"
return download.body.pipeThrough(resultTransform)
// "Failed to execute 'pipeThrough' on 'ReadableStream': Failed to read the 'readable' property from 'ReadableWritablePair': Failed to convert value to 'ReadableStream'"
Along with every combination with .body and .pipe.
I'm sure I am overcomplicating things there, how do I pipe the stream into the transform?