Skip to content
Myr

text.ts

This file

Path

src/helper/streaming/text.ts

15 lines · 504 bytes · TypeScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than f0b094d point at it.

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 1–15why, one step back
1import type { Context } from '../../context'
2import { TEXT_PLAIN } from '../../context'3import type { StreamingApi } from '../../utils/stream'4import { stream } from './'56export const streamText = (7 c: Context,8 cb: (stream: StreamingApi) => Promise<void>,9 onError?: (e: Error, stream: StreamingApi) => Promise<void>10): Response => {11 c.header('Content-Type', TEXT_PLAIN)12 c.header('X-Content-Type-Options', 'nosniff')13 c.header('Transfer-Encoding', 'chunked')14 return stream(c, cb, onError)15}