UNPKG

@0xplaygrounds/rig-wasm

Version:

A TS and WebAssembly-based port of the Rust agentic AI framework Rig.

19 lines (17 loc) 422 B
// --- decodeReadableStream function --- async function* decodeReadableStream(stream) { const reader = stream.getReader(); try { while (true) { const { done, value } = await reader.read(); if (done) break; const chunk = value; yield chunk; } } finally { reader.releaseLock(); } } export { decodeReadableStream };