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

reddit-user-dump

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reddit-user-dump - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

21

index.js

@@ -9,3 +9,12 @@ var request = ('request');

var qs = require('querystring')
var redditStats = require('measured').createCollection();
var requests_per_second = function() {
try {
var reqsPerSec = redditStats.toJSON().requestsPerSecond.mean;
} catch (err) {
var reqsPerSec = 0;
}
return reqsPerSec;
}

@@ -21,2 +30,3 @@ module.exports = function(username, lastParsed) {

function pullJSON(path, callback) {
redditStats.meter('requestsPerSecond').mark();
request({

@@ -31,4 +41,4 @@ url: 'http://www.reddit.com/' + path,

pullJSON(username_path, function(error, res, user_data) {
if (error) {
callback(error, null);
if (error || user_data.error) {
readStream.emit('user', userObj);
} else {

@@ -44,3 +54,3 @@ try {

} catch (err) {
readStream.emit('error', err, user_data);
}

@@ -55,3 +65,3 @@

pullJSON(path, function(err, res, body) {
if (err) return next(e);
if (err || body.error) return next;
try {

@@ -79,2 +89,5 @@ last = body.data.after

}
setTimeout(function() {
readStream.emit('metrics', requests_per_second());
}, 5 * 1000);

@@ -81,0 +94,0 @@ function loop() {

2

package.json
{
"name": "reddit-user-dump",
"version": "0.0.5",
"version": "0.0.6",
"description": "dumps a redditor's history in json",

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

@@ -7,2 +7,3 @@ var lastParsed = 0;

var total = 0;
function wrapper(username, callback) {

@@ -28,3 +29,3 @@ var test = require('../index.js')

console.log(metrics + ' requests per second');
totalApiCalls +=1;
totalApiCalls += 1;
})

@@ -48,9 +49,14 @@ .on('page', function(after, count) {

//console.log('err', err)
throw(err)
throw (err)
});
}
wrapper('hortinstein', function(e, r) {
// wrapper('hortinstein', function() {
// assert.equal(totalPages, totalApiCalls);
// });
});
wrapper('nina1987', function(e, r) {
wrapper('hortinstein', function() {
assert.equal(totalPages, totalApiCalls);
});
})
});
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