| 206 | // ToStreamable can return arrays, iterables, nested structures |
| 207 | { |
| 208 | class MultiPartMessage { |
| 209 | constructor(private parts: string[]) {} |
| 210 | |
| 211 | *[Stream.toStreamable](): Generator<string> { |
| 212 | for (let i = 0; i < this.parts.length; i++) { |
| 213 | yield `${i > 0 ? '|' : ''}${this.parts[i]}`; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | const readable = Stream.from([new MultiPartMessage(['header', 'body', 'footer'])]); |
| 219 | const text = await Stream.text(readable); |
nothing calls this directly
no outgoing calls
no test coverage detected