
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@koa/json-async-iterator
Advanced tools
Koa JSON response body streaming for async iterators
const jsonAsyncIterator = require('@koa/json-async-iterator')
const app = new Koa()
app.use(jsonAsyncIterator())
app.use(async ctx => {
const iterator = async function* () {
yield Promise.resolve({ foo: 'bar' })
yield Promise.resolve({ baz: 'qux' })
}
ctx.body = iterator()
})
Output:
[
{"foo":"bar"}
,
{"baz":"qux"}
]
Example with PostgreSQL:
import QueryStream from 'pg-query-stream'
import pg from 'pg'
const client = new pg.Client()
await client.connect()
// later in your middleware
app.use(async (ctx) => {
// stream all the rows from the database to the client
ctx.body = client.query(new QueryStream(`
SELECT *
FROM posts
ORDER BY id ASC
`))
})
beforeThe string to write before the first value in the iterator.
Default: '[\n'
separatorThe string to write between each value in the iterator.
Default: '\n,\n'
afterThe string to write after the last value in the iterator.
Default: '\n]'
formatErrorA function that takes an error and returns a value to be stringified.
Default: (err) => ({ error: { message: err.message } })
prettyWhether to pretty-print the JSON.
Default: false
spacesThe number of spaces to use for pretty-printing.
Default: 2
MIT
FAQs
Koa JSON response body streaming for async iterators
We found that @koa/json-async-iterator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.