npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rock-req

v5.1.3

Published

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

Downloads

3,886

Readme

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!

| Library | NodeJS 16 | NodeJS 18 | NodeJS 20* | Size deps inc. | | ------------ |--------------:|--------------:| --------------:| --------------:| | rock-req 🙋‍♂️ | 22816 req/s | 21797 req/s | 21964 req/s | 144 LOC | | simple-get | 2937 req/s | 3260 req/s | 21258 req/s | 317 LOC | | axios | 5090 req/s | 4910 req/s | 3196 req/s | 13983 LOC | | got | 2163 req/s | 1762 req/s | 9961 req/s | 9227 LOC | | fetch | 2101 req/s | 2102 req/s | 2020 req/s | 13334 LOC | | request | 2249 req/s | 1869 req/s | 15815 req/s | 46572 LOC | | superagent | 2776 req/s | 2100 req/s | 2895 req/s | 16109 LOC | | phin | 3178 req/s | 1164 req/s | 21299 req/s | 331 LOC | | undici* | 24095 req/s | 24378 req/s | 24191 req/s | 16225 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:

Thank you Feross Aboukhadijeh, creator of simple-get