Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rock-req

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rock-req

Ultra-light (150 LOC, No dependencies) & Ultra-fast request library with reliable retry on failure, http/https, redirects, gzip/deflate/brotli, extensible, proxy, streams, JSON mode, forms, timeout

  • 5.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
724
decreased by-43.3%
Maintainers
3
Weekly downloads
 
Created
Source

rock-req logo

Rock-req

⭐️⭐️ Ensure your HTTP requests always reach their destination as efficiently as possible! ⭐️⭐️

Tested on Mac, Linux, Windows with NodeJS 16, 18, 19, 20

npm ci javascript style guide

🔥 Why?

In most existing libraries (2023):

  • Managing reliable retries is difficult, tricky with streams and not battle-tested
  • Using multiple forward proxies has several benefits like higher availability and increased bandwidth but Intercepting retries to use another Egress controller between two requests is not possible.
  • Many request libraries are heavy: node-fetch, superagent, needle, got, axios, request
  • Lightweight alternatives are not as light as they claim due to dependencies (simple-get, tiny-req, puny-req, phin, ...)

⚡️ Rock-req solves these problems with only 150 lines of code and zero dependencies

It also supports many features:

  • Follows redirects
  • Handles gzip/deflate/brotli responses
  • Modify defaults
  • Extend and create new instances
  • Automatically destroy input/output stream on error and premature close event
  • Advanced retries
  • URL Rewrite
  • Ultra-fast (> 20k req/s)
  • Keep Alive by default (3000ms)
  • Composable
  • Timeouts
  • HTTPS / HTTP
  • Composes well with npm packages for features like cookies, proxies, form data, & OAuth
  • Keep 98% of the simple-get API (fork source)

When the callback is called, the request is 100% finished, even with streams.

🚀 Benchmark Rock-req vs got, axios, node-fetch, phin, simple-get, superagent, ...

Stop using "slow by-default" and "false-light" HTTP request libraries!

LibraryNodeJS 16NodeJS 18NodeJS 20*Size deps inc.
rock-req 🙋‍♂️22816 req/s21797 req/s21964 req/s144 LOC
simple-get2937 req/s3260 req/s21258 req/s317 LOC
axios5090 req/s4910 req/s3196 req/s13983 LOC
got2163 req/s1762 req/s9961 req/s9227 LOC
fetch2101 req/s2102 req/s2020 req/s13334 LOC
request2249 req/s1869 req/s15815 req/s46572 LOC
superagent2776 req/s2100 req/s2895 req/s16109 LOC
phin3178 req/s1164 req/s21299 req/s331 LOC
undici*24095 req/s24378 req/s24191 req/s16225 LOC

NodeJS 20 activates HTTP keep-alive by default, like rock-req

undici is a low-level API, faster alternative to the native NodeJS http module. It is the glass ceiling limit for NodeJS.

rock-req uses only the native NodeJS http module and provides many high-level features, a lot more than phin and simple-get with fewer lines of code.

Tested on Macbook Pro M1 Max

Install

  npm install rock-req

Documentation

The full documentation is here to reduce Node package file size.

Supporters

This packaged in maintained by Carbone:

Carbone.io logo

Thank you Feross Aboukhadijeh, creator of simple-get

Keywords

FAQs

Package last updated on 15 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc