New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@petitchevalroux/http-download-stream

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@petitchevalroux/http-download-stream - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

package.json
{
"name": "@petitchevalroux/http-download-stream",
"version": "1.2.1",
"version": "1.2.2",
"description": "Node transform stream downloading url in input with retry and rate limit",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -13,3 +13,3 @@ "use strict";

constructor(options) {
options = Object.assign({
const instanceOptions = Object.assign({
"timeout": 5000,

@@ -24,7 +24,7 @@ "followRedirect": true,

}, options || {});
if (typeof(options.httpClient) === "undefined") {
if (typeof(instanceOptions.httpClient) === "undefined") {
this.httpClient = request.defaults({
"timeout": options.timeout,
"followRedirect": options.followRedirect,
"maxRedirects": options.maxRedirects,
"timeout": instanceOptions.timeout,
"followRedirect": instanceOptions.followRedirect,
"maxRedirects": instanceOptions.maxRedirects,
"gzip": true,

@@ -36,7 +36,8 @@ "headers": {

} else {
this.httpClient = options.httpClient;
this.httpClient = instanceOptions.httpClient;
}
this.limiter = new RateLimiter(options.rateCount, options.rateWindow);
this.retries = options.retries;
this.retryMinTimeout = options.retryMinTimeout;
this.limiter = new RateLimiter(instanceOptions.rateCount,
instanceOptions.rateWindow);
this.retries = instanceOptions.retries;
this.retryMinTimeout = instanceOptions.retryMinTimeout;
}

@@ -83,9 +84,13 @@

self.attempt(url, function(err, response) {
if (!err && response.output.statusCode >
499) {
if (attempt <= self.retries) {
err = 499;
}
}
if (operation.retry(err)) {
if (operation.retry(err || (
response.output.statusCode >
499 ?
new Error(
"Wrong http status " +
JSON.stringify({
status: response
.output
.statusCode,
url: url
})) : false))) {
return;

@@ -92,0 +97,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