UNPKG

jtc-utils

Version:
18 lines (17 loc) 473 B
export class MemoryReadableStream extends ReadableStream { constructor(input) { super({ start(controller) { if (Array.isArray(input)) { for (const item of input) { controller.enqueue(item); } } else { controller.enqueue(input); } controller.close(); }, }); } }