I have a function that needs to return a Readable stream synchronously. I have a function that creates a Readable stream with the data I require, but it's an asynchronous method. How can I return a reference to the synchronous stream?
class SomeStreamCreator {
_requestStream() {
fetchStream()
.then(stream => /* stream is a Readable stream with data */)
return /* somehow need to return the Readable stream here */
}
}