Which HTTP client for Node.js? Should Node.js stop bundling npm?
A Node.js newsletter covering HTTP client performance, fixing a race condition, and discussing whether Node.js should drop npm.
Hi Folks,
Here is a short & sweet newsletter to show you the analysis I did on the performance of the HTTP clients of Node.js, as well as the burning question of the bond between Node.js and npm.
Which HTTP client for Node.js
Quite a few people have asked me what HTTP client I recommend for Node.js. In concert with my friend Ethan Arrowood, we have prepared a benchmark for you to decide.
If your application mostly does HTTP API calls, use undici.request
directly, you'll experience a 3x acceleration compared to got
, fetch
, axios
or node-fetch
. fetch
is now faster than node-fetch
, but still barely behind axios and request.
An earlier version of this benchmark showed better performance of got, axios, node-fetch and request. Turns out we did not configure them properly with an http.Agent to simulate the same scenario. Thanks to the folks on X, I investigated it further and made a fix.
Let me know if you have any more questions! If you would like to reproduce those yourself, here is the source code.
I (almost) fixed a race condition for fs.watch() on Linux
I'm back streaming this month, and we fixed a race condition when using the Node.js fs.watch()
function on Linux:
This is a great series on how to investigate and work on Node.js core. Here is the final PR. The PR is likely to land soon!
Should Node.js stop bundling npm?
The Node.js is discussing at length if Node.js should drop npm
from its bundle and/or enable corepack by default. Do you use Corepack to run pnpm or yarn? It's currently listed as one of the key installation methods for borht package managers.
Take a look here for my "long" reaction to the topic. What do you think?
Releases
- @fastify/swagger-ui v2.1.0 fixes a vulnerability introduced in v2.0.0.
- @fastify/swagger v8.14.0 fixes nested examples in OpenAPI schemas for request body & response.
- @fastify/cookie v9.3.0 export integrated cookie functionality and various refactoring.
- undici v6.4.0 fixes many bugs and implements throwOnMaxRedirect option for RedirectHandler.
- @fastify/accepts-serializer v5.3.0 removes all deprecation warnings.
- hyperid v3.2.0 adds dynamic loader for buffer.
Articles
- I'm so proud to be part of the developers sponsored by frontendmasters.
- OpenJS Security Audit for nvm Completed Successfully | OpenJS Foundation
- Now it's PostgreSQL's turn to have a bogus CVE
- Streams and React Server Components
- A 2024 Wishlist for Node's Test Runner
- npm in Review: A 2023 Retrospective on Growth, Security, and Quirky Facts - Socket
- GitHub-hosted runners: Double the power for open source
- React, where are you going?
Upcoming Events
A journey into Fastify and Beyond
Join me for the next Platformatic masterclass, where I'll be exploring:
- Fastify’s design principles & low-overhead philosophy
- The key principles of extensible architecture
- How to build modern Node.js & Fastify backends
Join me on Thursday 25th of January at 4:30pm (GMT) / 8:30am (PST).
CityJS London
This April I will be keynoting CityJS London (5th of April) with my talk "The Alleged 'End' of Node.js is Much Ado About Nothing".
Tickets are available at https://london.cityjsconf.org/.