()
| 194 | |
| 195 | // Create a generator that yields JsonMessage objects |
| 196 | function* messageSource() { |
| 197 | yield new JsonMessage({ type: 'hello', value: 1 }); |
| 198 | yield '\n'; |
| 199 | yield new JsonMessage({ type: 'world', value: 2 }); |
| 200 | } |
| 201 | |
| 202 | const text = await Stream.text(Stream.from(messageSource())); |
| 203 | console.log('ToStreamable output:', text); |