/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-streamtext-352e6ceaccb2-streamtext-s0675-c0000.md
`streamText()` - hono-docs
streamText() Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt streamtext Summary It returns a stre...
streamText()
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#streamtext
Summary
It returns a streaming response with Content-Type: text/plain, Transfer-Encoding: chunked, and X-Content-Type-Options: nosniff headers. ```ts app.get('/streamText', (c) => { return streamText(c, async (stream) => { // Write a text...
Content
It returns a streaming response with Content-Type: text/plain, Transfer-Encoding: chunked, and X-Content-Type-Options: nosniff headers.
app.get('/streamText', (c) => {
return streamText(c, async (stream) => {
// Write a text with a new line ('\n').
await stream.writeln('Hello')
// Wait 1 second.
await stream.sleep(1000)
// Write a text without a new line.
await stream.write(`Hono!`)
})
})::: warning
If you are developing an application for Cloudflare Workers, streaming may not work well on Wrangler. If so, add Identity for Content-Encoding header.
app.get('/streamText', (c) => {
c.header('Content-Encoding', 'Identity')
return streamText(c, async (stream) => {
// ...
})
}):::