MCPcopy Create free account
hub / github.com/WinterTC55/iter-streams / MultiPartMessage

Class MultiPartMessage

samples/01-basic-creation.ts:208–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected