Hwp
No description available
Install / Use
/learn @mcollina/HwpREADME
hwp
Consume Async Iterators with a highwatermark, i.e. in batches. This allows for multiple processing happening in parallel instead of one at a time.
The default highwatermark is 16.
TypeScript type definitions are included.
Install
npm i hwp
Usage
import { forEach, map, mapIterator, mapper } from 'hwp'
import { pipeline } from 'stream/promises'
const expected = ['a', 'b', 'c']
async function * something () {
const toSend = [...expected]
yield * toSend
}
await forEach(something(), async function (item, { signal }) {
return someAsyncFunction(item, { signal })
}, 16)
const res = mapIterator(something(), async function (item, { signal }) {
return someAsyncFunction(item, { signal })
}, 16)
for await (const item of res) {
console.log(item)
}
console.log(await map(something(), async function (item, { signal }) {
return someAsyncFunction(item, { signal })
}), 16)
await pipeline(
something(),
mapper((item, { signal }) => {
return someAsyncFunction(item, { signal })
}, 16),
async function (source) {
for await (const item of source) {
console.log(item)
}
}
)
License
MIT
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
