René's URL Explorer Experiment


Title: net: add experimental net/promises API by Ethan-Arrowood · Pull Request #63965 · nodejs/node · GitHub

Open Graph Title: net: add experimental net/promises API by Ethan-Arrowood · Pull Request #63965 · nodejs/node

X Title: net: add experimental net/promises API by Ethan-Arrowood · Pull Request #63965 · nodejs/node

Description: Adds an experimental net/promises namespace that provides promise-based variants of net's connection and listening operations, mirroring the existing fs/promises and dns/promises modules. It is accessible via require('node:net/promises') or require('node:net').promises. Motivation net has no promise-based API. To await a connected socket or a listening server today you have to hand-wire the 'connect'/'listening' and 'error' events into a new Promise, or reach for events.once. There is long-standing demand for a first-class promise API for these one-shot lifecycle moments (Refs: #21482). net is stream- and event-oriented, so only its one-shot async moments map cleanly to promises (establishing a connection and binding a server). The rest of the api remains the same. What's added netPromises.connect(options) / connect(path) / connect(port[, host]) — resolves with a connected net.Socket once its 'connect' event fires; rejects on connection failure or abort, destroying the socket. netPromises.listen([options]) — creates a server, begins listening, and resolves with the listening net.Server once its 'listening' event fires; rejects if it fails to bind or is aborted before listening, closing the server. Accepts a connectionListener option and the usual net.createServer / server.listen options. The signal aborts the server for its entire lifetime (aborting after it is listening closes it), matching net.Server's own signal behavior. net.Server is now async iterable: for await (const socket of server) yields each incoming connection, as an alternative to the 'connection' event (mirrors readline.Interface). Connections buffer if the consumer is slow; server.maxConnections bounds concurrency. The synchronous helpers (isIP, isIPv4, isIPv6, BlockList, SocketAddress) are re-exported for convenience. Both functions accept an optional AbortSignal and reject with an AbortError when it is aborted, consistent with timers/promises and readline/promises. Example: import { connect, listen } from 'node:net/promises'; const server = await listen({ port: 0 }); const socket = await connect({ port: server.address().port }); // Consume incoming connections as an async iterator: for await (const conn of server) { conn.end('hello world!'); } A note on naming (connect/listen, not createConnection/createServer) The naming here is intentional. This API promisifies actions that complete: connect() resolves once the connection is established, and listen() resolves once the server is listening. The function name is the action being awaited, and the two form a parallel pair. That is deliberately not the factory taxonomy of the callback API. There, createConnection() is the canonical name because it both creates a socket and initiates connecting. Creation and the action are fused, so the factory name also implies the action. createServer(), by contrast, is a pure factory: it does not listen; listening is the separate server.listen() step. So a createConnection/createServer pairing would be inconsistent in a promise API. createServer has no completion to await. Naming the functions for their actions (connect/listen) keeps the pair coherent, and there is no factory counterpart to alias, so createConnection is intentionally omitted. Notes New experimental API (Stability: 1). semver-minor. Implemented on top of events.once(emitter, name, { signal }), so error and abort handling match the rest of core. Documentation and tests included. Refs: #21482 Assisted-by: Claude Opus 4.8 noreply@anthropic.com

Open Graph Description: Adds an experimental net/promises namespace that provides promise-based variants of net's connection and listening operations, mirroring the existing fs/promises and dns/promises modules. It is...

X Description: Adds an experimental net/promises namespace that provides promise-based variants of net's connection and listening operations, mirroring the existing fs/promises and dns/promises modules. I...

Opengraph URL: https://github.com/nodejs/node/pull/63965

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9335e88c-ce7f-4bdf-cc10-d8433f5c36c9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEBB4:137C1B:5A3F34:7589F5:6AED2A14
html-safe-nonce84639099c0b4ec9f1d0bf946e69b4039231a53d58ad717d2c7638f59fa394e34
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkI0OjEzN0MxQjo1QTNGMzQ6NzU4OUY1OjZBRUQyQTE0IiwidmlzaXRvcl9pZCI6IjY3ODQwOTIzMzE2MTMzMzI2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacafe2f7621f09140377c9f9fa9a711d92bff469a5823c7f237793a4fdd71a11bd
hovercard-subject-tagpull_request:3884309066
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/63965/files
twitter:imagehttps://avatars.githubusercontent.com/u/16144158?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/16144158?s=400&v=4
og:image:altAdds an experimental net/promises namespace that provides promise-based variants of net's connection and listening operations, mirroring the existing fs/promises and dns/promises modules. It is...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release98b41fa4b5635ceb45a4c54320fced73817ff290
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/63965/changes#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F63965%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F63965%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/63965/changes
Reloadhttps://github.com/nodejs/node/pull/63965/changes
Reloadhttps://github.com/nodejs/node/pull/63965/changes
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
nodejs-github-bothttps://github.com/nodejs-github-bot
nodejs:mainhttps://github.com/nodejs/node/tree/main
Ethan-Arrowood:net-promisehttps://github.com/Ethan-Arrowood/node/tree/net-promise
Conversation 41 https://github.com/nodejs/node/pull/63965
Commits 4 https://github.com/nodejs/node/pull/63965/commits
Checks 71 https://github.com/nodejs/node/pull/63965/checks
Files changed https://github.com/nodejs/node/pull/63965/files
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
net: add experimental net/promises API https://github.com/nodejs/node/pull/63965/changes#top
Show all changes 4 commits https://github.com/nodejs/node/pull/63965/files
ab5b8e9 net: add experimental net/promises API Ethan-Arrowood Jun 17, 2026 https://github.com/nodejs/node/pull/63965/commits/ab5b8e9e50baf109dee3f298f581bed9f51007fb
84ae422 net: tie listen() signal to server lifetime, async-iterable Server Ethan-Arrowood Jun 18, 2026 https://github.com/nodejs/node/pull/63965/commits/84ae4220da54bb8710973be6156f48b0101b5679
25fa21a net: use throwIfAborted and improve server iteration example Ethan-Arrowood Jun 19, 2026 https://github.com/nodejs/node/pull/63965/commits/25fa21a6bf2811adefb6103e5d9cd5f3bb4f8123
d5c13e8 net: default net/promises listen() to an ephemeral port Ethan-Arrowood Jul 24, 2026 https://github.com/nodejs/node/pull/63965/commits/d5c13e822782e94edb44500c6e54b0942de6813c
Clear filters https://github.com/nodejs/node/pull/63965/files
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
net.md https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
promises.js https://github.com/nodejs/node/pull/63965/changes#diff-c455452ecdce0b259515a37791e8b82fe4a515559ddfd16c8000db52c1409ce8
net.js https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
promises.js https://github.com/nodejs/node/pull/63965/changes#diff-821ee33d11a6931335aacff91372b1eb1828ccff77f10bf4848d93e88cc3ba16
test-net-promises-connect.js https://github.com/nodejs/node/pull/63965/changes#diff-20589a91d7b722a33615840a6188115a9a297c2942b6d49ce1615e6dd8dfec71
test-net-promises-listen.js https://github.com/nodejs/node/pull/63965/changes#diff-7d929a30401761b0f5ff8959feb355e29557e9b7f1092e8d3cdbace384efffb4
test-net-server-async-iterator.js https://github.com/nodejs/node/pull/63965/changes#diff-f846935ceca1c4f1ffc0d6bf3cc1d43d3531746322f9b4cd495523e8fbdcc84c
test-repl-tab-complete-import.js https://github.com/nodejs/node/pull/63965/changes#diff-ebddee1f732172381a4bc2ce8d1833d576d21fde32e916f0b10754145e13726f
test-repl-tab-complete-require.js https://github.com/nodejs/node/pull/63965/changes#diff-9f8d074296723791f3efef1c06b5ef9a04db427903be32c044c7488167739010
doc/api/net.mdhttps://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
View file https://github.com/Ethan-Arrowood/node/blob/d5c13e822782e94edb44500c6e54b0942de6813c/doc/api/net.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/63965/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
pimterryhttps://github.com/pimterry
Jul 21, 2026https://github.com/nodejs/node/pull/63965/changes#r3620452318
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
jasnellhttps://github.com/jasnell
Jul 14, 2026https://github.com/nodejs/node/pull/63965/changes#r3580512457
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
jasnellhttps://github.com/jasnell
Jul 14, 2026https://github.com/nodejs/node/pull/63965/changes#r3580531231
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
https://github.com/nodejs/node/pull/63965/changes#diff-d76469e9e7f555294a7a5488c5c8fc4ef8ce5aea448cc26a1322d1ab693e09ca
lib/internal/net/promises.jshttps://github.com/nodejs/node/pull/63965/changes#diff-c455452ecdce0b259515a37791e8b82fe4a515559ddfd16c8000db52c1409ce8
View file https://github.com/Ethan-Arrowood/node/blob/d5c13e822782e94edb44500c6e54b0942de6813c/lib/internal/net/promises.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/63965/{{ revealButtonHref }}
jasnellhttps://github.com/jasnell
Jun 19, 2026https://github.com/nodejs/node/pull/63965/changes#r3440597127
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
Ethan-Arrowoodhttps://github.com/Ethan-Arrowood
Jun 19, 2026https://github.com/nodejs/node/pull/63965/changes#r3443430110
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://github.com/nodejs/node/pull/63965/changes#diff-20589a91d7b722a33615840a6188115a9a297c2942b6d49ce1615e6dd8dfec71R35https://github.com/nodejs/node/pull/63965/changes#diff-20589a91d7b722a33615840a6188115a9a297c2942b6d49ce1615e6dd8dfec71R35
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
jasnellhttps://github.com/jasnell
Jul 14, 2026https://github.com/nodejs/node/pull/63965/changes#r3580542162
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
pimterryhttps://github.com/pimterry
Jul 21, 2026https://github.com/nodejs/node/pull/63965/changes#r3620466520
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
Ethan-Arrowoodhttps://github.com/Ethan-Arrowood
Jul 24, 2026https://github.com/nodejs/node/pull/63965/changes#r3645976217
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
jasnellhttps://github.com/jasnell
Jul 14, 2026https://github.com/nodejs/node/pull/63965/changes#r3580555662
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
lib/net.jshttps://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
View file https://github.com/Ethan-Arrowood/node/blob/d5c13e822782e94edb44500c6e54b0942de6813c/lib/net.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/63965/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
https://github.com/nodejs/node/pull/63965/changes#diff-218c57e035f64b18af4db037c96f13014aeb40a1f783d4f52919e2075621da0c
lib/net/promises.jshttps://github.com/nodejs/node/pull/63965/changes#diff-821ee33d11a6931335aacff91372b1eb1828ccff77f10bf4848d93e88cc3ba16
View file https://github.com/Ethan-Arrowood/node/blob/d5c13e822782e94edb44500c6e54b0942de6813c/lib/net/promises.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/63965/{{ revealButtonHref }}
test/parallel/test-net-promises-connect.jshttps://github.com/nodejs/node/pull/63965/changes#diff-20589a91d7b722a33615840a6188115a9a297c2942b6d49ce1615e6dd8dfec71
View file https://github.com/Ethan-Arrowood/node/blob/d5c13e822782e94edb44500c6e54b0942de6813c/test/parallel/test-net-promises-connect.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/63965/{{ revealButtonHref }}
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
Please reload this pagehttps://github.com/nodejs/node/pull/63965/changes
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.