Skip to content

Instantly share code, notes, and snippets.

@crash2burn
Created March 31, 2015 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save crash2burn/76c840a05416dd394179 to your computer and use it in GitHub Desktop.
Save crash2burn/76c840a05416dd394179 to your computer and use it in GitHub Desktop.
var http = require('http')
function Wat() {
}
Wat.prototype.get = function(cb) {
var options = {
host: "http://whatevaljksdskajd.com",
port: "80",
path: "",
headers: {'Content-Type': 'application/json'},
method: 'GET',
followAllRedirects: true
};
var callback = function(response) {
response.setEncoding('utf-8');
var str = ''
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
cb(null, str)
});
response.on('error', function (e) {
cb(e);
});
}
var req = http.request(options, callback);
req.on('error', function (e) {
cb(e);
});
req.end();
}
w = new Wat();
setInterval(function() {
w.get(function Werd(res) {
//console.log(res)
})
}, 500)
setInterval(function () {
console.log(process.memoryUsage().rss)
}, 2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment