timed
A response body as it arrives: each chunk with the milliseconds since the request.
export async function timed(res: Response): Promise<{ ms: number; text: string }[]> { const t0 = Date.now(); const out: { ms: number; text: string }[] = []; const dec = new TextDecoder(); for await (const c of res.body!) out.push({ ms: Date.now() - t0, text: dec.decode(c as Uint8Array, { stream: true }) }); return out; }