温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/http/IncomingMessage/forEach
点击访问原文链接

IncomingMessage.forEach method | Node.js http module | Bun

IncomingMessage.forEach method | Node.js http module | BunBuildDocsReferenceGuidesBlogDiscord/node:http/IncomingMessage/forEachMforEach

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:http/IncomingMessage/forEachMforEach

method

http.IncomingMessage.forEachforEach(fn: (data: any, options?: Abortable) => void | Promisevoid>,options?: PickReadableOperatorOptions, 'signal' | 'concurrency'>): Promisevoid>;This method allows iterating a stream. For each chunk in the stream the fn function will be called. If the fn function returns a promise - that promise will be awaited.

This method is different from for await...of loops in that it can optionally process chunks concurrently. In addition, a forEach iteration can only be stopped by having passed a signal option and aborting the related AbortController while for await...of can be stopped with break or return. In either case the stream will be destroyed.

This method is different from listening to the 'data' event in that it uses the readable event in the underlying machinary and can limit the number of concurrent fn calls.

@param fna function to call on each chunk of the stream. Async or not.

@returnsa promise for when the stream has finished.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录