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

httpreq

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpreq - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

12

examples.js

@@ -11,4 +11,4 @@ var httpreq = require('./httpreq');

// example6(); // u can use doRequest instead of .get or .post
// example7(); // download a binary file:
example8(); //send json
example7(); // download a binary file:
// example8(); // send json
// example9(); // send your own body content (eg. xml):

@@ -117,3 +117,9 @@ // example10(); // set max redirects:

function example7(){
httpreq.get('https://ssl.gstatic.com/gb/images/k1_a31af7ac.png', {binary: true}, function (err, res){
httpreq.get('https://ssl.gstatic.com/gb/images/k1_a31af7ac.png', {
binary: true,
progressCallback: function (err, progress) {
console.log(progress);
}
},
function (err, res){
if (err){

@@ -120,0 +126,0 @@ console.log(err);

@@ -165,5 +165,22 @@ /*

var ended = false;
var currentsize = 0;
res.on('data', function (chunk) {
chunks.push(chunk);
if(o.progressCallback){
var totalsize = res.headers['content-length'];
if(totalsize){
currentsize += chunk.length;
o.progressCallback(null, {
totalsize: totalsize,
currentsize: currentsize,
percentage: currentsize*100/totalsize
});
}else{
o.progressCallback(new Error("no content-length specified for file, so no progress monitoring possible"));
}
}
});

@@ -170,0 +187,0 @@

{
"name": "httpreq",
"description": "node-httpreq is a node.js library to do HTTP(S) requests the easy way",
"version": "0.3.4",
"version": "0.3.5",
"author": {

@@ -6,0 +6,0 @@ "name": "Sam Decrock",

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