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 - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

4

index.js

@@ -74,3 +74,3 @@ const http = require('http')

opts.prevError = err
return setTimeout(rock, opts.retryDelay, opts, cb) // retry in 100ms
return setTimeout(rock, opts.retryDelay, opts, cb) // retry
}

@@ -87,3 +87,3 @@ return cb(err)

streamToCleanOnError.push(stream)
stream.once('error', onRequestEnd)
stream.on('error', onRequestEnd) // do not use once()! A stream can emit mutiple error event
stream.once('close', () => {

@@ -90,0 +90,0 @@ if (stream.readableEnded === false || stream.writableEnded === false) return onRequestEnd(new Error('ERR_STREAM_PREMATURE_CLOSE'))

{
"name": "rock-req",
"description": "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",
"version": "5.1.1",
"version": "5.1.2",
"author": {

@@ -45,4 +45,5 @@ "name": "David Grelaud & Feross Aboukhadijeh"

"scripts": {
"test": "tape test/*.js"
"test": "tape test/*.js",
"standard": "node_modules/.bin/standard"
}
}
<p align="center">
<img src="https://raw.githubusercontent.com/carboneio/rock-req/master/doc/rock-req-logo.svg" alt="rock-req logo" height="120"/>
<img src="https://raw.githubusercontent.com/carboneio/rock-req/master/doc/rock-req-logo.svg" alt="rock-req logo" height="150"/>
</p>
<h1 align="center" style="border-bottom:none; font-size: 2.2em;">Rock-req.js</h1>
<h1 align="center" style="border-bottom:none;">Rock-req</h1>
<p align="center">⭐️⭐️ Ensure your HTTP requests always reach their destination as <b>efficiently</b> as possible! ⭐️⭐️</p>
<p align="center">Tested on Mac, Linux, Windows with NodeJS 16, 18, 19</p>
<p align="center">Tested on Mac, Linux, Windows with NodeJS 16, 18, 19, 20</p>

@@ -57,15 +57,17 @@ [![npm][npm-image]][npm-url] [![ci][ci-image]][ci-url] [![javascript style guide][standard-image]][standard-url]

| Library | Speed | Size deps inc. |
| ------------ |-----------------:| --------------:|
| rock-req 🙋‍♂️ | 21797 req/s | 144 LOC |
| simple-get | 3260 req/s | 317 LOC |
| axios | 4910 req/s | 13983 LOC |
| got | 1762 req/s | 9227 LOC |
| fetch | 2102 req/s | 13334 LOC |
| request | 1869 req/s | 46572 LOC |
| superagent | 2100 req/s | 16109 LOC |
| phin | 1164 req/s | 331 LOC |
| undici* | 24378 req/s | 16225 LOC |
| 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.

@@ -75,3 +77,3 @@

> Tested with NodeJS 18.x LTS on Macbook Pro M1 Max
> Tested on Macbook Pro M1 Max

@@ -598,11 +600,5 @@

- [ ] replace deprecated `url.parse` by `new URL` but new URL is slower than url.parse. Let's see if Node 20 LTS is faster
- [ ] add advanced timeout (response timeout)
- [ ] test prevError
- [ ] test HTTP abort signal option
- [ ] test input stream error with 502 error retry. Does stream.resume destroy all streams?
- [ ] promisify
- [ ] typescript type
- [ ] NodesJS 19 doesn't need agent.timeout to exit https://github.com/nodejs/node/issues/47228 https://github.com/nodejs/node/issues/2642
- [ ] promisify ?
- [ ] typescript type ?
# Supporters

@@ -609,0 +605,0 @@

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