Integrating Streams with Callback Interface

I'm working with a callback interface (third party lib) that looks something like this:

onParsedToken: (callback: (token: Token) => void) => void;
write: (value: string) => void


I have a Stream "A" of string values that need to be fed to the write() method, and I would like to push tokens received in the onParsedToken callback to Stream "B".

I'd like to return a single stream that when "subscribed to" starts pulling values from Stream A, pushing them into Stream B - Stream B's emissions would be emitted in the "top level" Stream.

I'm not too sure how to achieve this
Was this page helpful?