Repository navigation
Open
Labels
neverstaleSomething that lasts foreverSomething that lasts forever
Description
Since the announcement of request going into "maintenance mode" (full details in #3142) I'd like to collect a list of alternative libraries to use. Please comment below and I'll update this table. When we have a list of good alternatives we should add this to the readme.
In no particular order and dreadfully incomplete;
| Package Name | Bundle Size | API Style | Summary |
|---|---|---|---|
| node-fetch | 0.4kb | promise / stream | A light-weight module that brings window.fetch to Node.js |
| bent | 1kb | fp / promise / stream | Functional HTTP client w/ async/await |
| got | 48.4kb | promise / stream | Simplified HTTP requests |
| make-fetch-happen | 442kb | promise / stream | make-fetch-happen is a Node.js library that wraps node-fetch-npm with additional features node-fetch doesn't intend to include, including HTTP Cache support, request pooling, proxies, retries, and more! |
| axios | 11.9kb | promise / stream | Promise based HTTP client for the browser and node.js |
| unfetch | 1kb | promise / stream | Tiny 500b fetch "barely-polyfill" |
| superagent | 18kb | chaining / promise | Small progressive client-side HTTP request library, and Node.js module with the same API, sporting many high-level HTTP client features |
| tiny-json-http | 22kb | promise | Minimalist HTTP client for GET and POSTing JSON payloads |
| needle | 164kb | chaining / promise | The leanest and most handsome HTTP client in the Nodelands |
| urllib | 816kb | callback / promise | Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more. |
Reacted by Haroen Viaene, Steven, Daniel de Paula, Joel Martínez, Gauthier Deroo, Lizz Parody, beeman, Nick K., Emilio Rios, Paul Rütter and 725 more
Reacted by Anton Ivanov, Владислав and Kimo
Reacted by Mike Erickson, reshma-epsilon, Stephen Wicklund, Piotr Gąsiorowski, clark, JonLuca De Caro, Andrew M., kaustubh bhagwat, dc, Luiz Felipe Weber and 7 more
Reacted by reshma-epsilon, Stephen Wicklund, Jerroyd Moore, clark, Sarah, Sandro, Henry, srk-stack, Chris Grivas, Wang Zixiao and 20 more
Reacted by Rinat Valiullov, Andrey Chalkin, Stephen Wicklund, Kirill, nastakhov, Eldorbek Makhkamov, Andrew Holsted, 题叶, Igor Strebz, promolic1 and 5 more
Reacted by Tierney Cyren, reshma-epsilon, Stephen Wicklund, hellboy81, Raphael, Dave Martinez, Sandro, Kamil Tomšík, Jani Haiko, Yaki Klein and 55 more
Reacted by Stephen Wicklund, Piotr Gąsiorowski, hellboy81, Dylan Armstrong, Raphael, Chia-Chun Chen, Sarah, Sandro, Baz, Wang Zixiao and 21 more
Reacted by Stephen Wicklund, Lorenzo Pieri, Johan Pouwelse, Sarah, Eduardo Pinho, KingDarBoja, Igor Atroshkin, Amit Beckenstein, Andres Felipe Bayona, Eana Hufwe and 28 more
Metadata
Metadata
Assignees
Labels
neverstaleSomething that lasts foreverSomething that lasts forever
Activity
jeffscottward commentedon Apr 1, 2019
As a frontend focused guy who also does node.js from time to time, axios has been my go to.
Easy API, from Facebook, works on browsers and node? Done
bnb commentedon Apr 1, 2019
Per a recent discussion with @mikeal, I have Bent a try. As a Node.js developer whose been using request for a while now, bent was definitely an easy transition - highly recommended 💖
paambaati commentedon Apr 1, 2019
@reconbot You might want to add
got, needle and urllib.simov commentedon Apr 1, 2019
Well, it feels kind of wrong to promote my own little library here, but since that's the goal of the issue, here it is: request-compose is a functional, 0 deps HTTP client with support for promises, streams, and a bunch of other useful options, most of which are very close to the ones found in request.
I also wrote an article about it. The general idea is that everyone is encouraged to compose their own HTTP clients, specifically tailored to their own needs.
As for the bundle size, I've no idea, but it should be pretty small, though this client was never designed to be used in the browser.
csantanapr commentedon Apr 1, 2019
It might be good to add the following columns to the table:
When putting side by side these numbers some libs have thousands of stars and million of downloads weekly, vs others in the hundreds.
My 2 cents, OK to ignore and move on, no need to correct or dispute the comment.
reconbot commentedon Apr 1, 2019
@csantanapr I agree, it might be worth comparing feature sets too. Proxy support, cache support, auth features etc. If you use a specific feature of request and need to find it elsewhere, this would be a good time to talk about it.
kreig303 commentedon Apr 1, 2019
axiosgets my vote, especially as a front-ender.JamesMGreene commentedon Apr 1, 2019
Worth a look:
ky(frontend) andky-universal(isomorphic)rmngrc commentedon Apr 2, 2019
Axios user here. That way, all our teams can use the same library regardless the environment: browser or nodejs (running in server or serverless). Very well maintained, and all our people love it.
sindresorhus commentedon Apr 2, 2019
We have a good comparison between
got,request,node-fetch,axios, andsuperagentin thegotreadme: https://github.com/sindresorhus/got#comparison(PR welcome if you see any inaccuracies. We've tried to keep it as neutral as possible)
Got also has a migration guide for moving from
request: https://github.com/sindresorhus/got/blob/master/migration-guides.mdtracker1 commentedon Apr 2, 2019
For me, I tend to do wrappers around fetch api, so node-fetch is my goto. Despite the negative aspects, I usually load it onto
global.fetchin node, so I can rely on it always being available, much like in the browser (via polyfill for older browsers). Can also useisomorphic-fetchwhich is pretty much a wrapper around node-fetch for node, and the fetch polyfill (or already available fetch) in browser. Since I don't have to support legacy browsers, I just use the global, and establish the global for use in node.vdeturckheim commentedon Apr 4, 2019
Hey, Wreck (https://www.npmjs.com/package/wreck) is what I use
Velveeta commentedon Apr 4, 2019
I would prefer something that mimics the fetch api on the client. Libs like axios, superagent, etc are higher level abstractions on top of a standard request library. As a replacement for the low-level request library, I'd like to see something that mirrors the low-level equivalent on the client for the purposes of universal js development. Libs like axios and superagent can then just reimplement themselves on top of that, and its users can continue using them, but those shouldn't be considered foundational for this purpose.
88 remaining items
🏗 Remove `request` package and friends (#33613)
PierreFritsch commentedon May 20, 2021
+1 for @csantanapr's suggestion of adding numbers, and thanks to @sindresorhus for sharing the comparison:
gotrequestnode-fetchkyaxiossuperagentAdded follow_set_referer option.
Replace deprecated request library with simple-get (#47)
LawsonCheng commentedon Jul 16, 2021
Hello, I have took the references from the API of request/request and created a new HTTP request library Poke in written typescript by myself. Appreciate if anyone can give it a try and make things better together :) Cheers🍺
https://github.com/LawsonCheng/poke
munierujp commentedon Aug 20, 2021
The comparison table in the README of got looks more detailed than the table here.
🏗 Remove `request` package and friends (ampproject#33613)
RussBrown00 commentedon Sep 3, 2021
My default would be
node-fetch, butgotwhile I've never personally used it seems interesting.edit: Some more reflecting has me thinking that node-fetch more acceptable testing and coverage and is probably the “safer” bet. It’s really not used in more than a handful of places.
neelkarma commentedon Feb 1, 2022
You might want to add undici - it's made by the nodejs team.
gradmna commentedon Feb 7, 2022
What is the alternative for this Node.js code?:
This Node.js code
requests Google's main page with the user agentMozilla/5.0 (compatible; Alternabot/1.0; +https://example.info/path/to/alternabots/info.html).101 comments LOL!
kyeotic commentedon Jun 1, 2022
Shameless plug: I've just updated request-micro to V2, now written in typescript. It weighs in at 7kb and has no dependencies. If you just need standard HTTP(s) stuff its the lightest-weight you can get. It's been getting a non-trivial >2k downloads a week for at least a year and is in use in several production systems, so I am confident it is stable and safe to use.
It is only for Node, but it is the smallest library in the OP table (which no longer has accurate sizes, sometimes off by a factor of over 50).
tracker1 commentedon Sep 14, 2022
Worth noting that
fetchitself is in recent node, and pretty much all browsers at this point.dgrelaud commentedon Apr 19, 2023
If you need an ultra small & ultra fast NodeJS request library (< 150 LOC, no dependencies), focused on simple and reliable retries (even with streams), with many features (gzip/deflate/brotli response follow redirect, instance, ...). Here is our modest contribution:
https://github.com/carboneio/rock-req
It is written in pure JS for performance.
krylov-krylov commentedon Aug 19, 2024
Sanyakry