Created
December 17, 2011 17:13
-
-
Save isaacs/1490782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = { | |
method:'GET', | |
headers: { | |
'Accept': 'application/rss+xml;q=1,application/atom+xml;q=1,application/xml;q=0.7,text/xml;q=0.6,text/html;q=0.2', | |
'Accept-Encoding': 'gzip, deflate', | |
'User-Agent': 'nodejs bot', //'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0', | |
'Host': 'www.burdafashion.com' | |
}, | |
host: 'www.burdafashion.com', | |
port: 80, | |
path: '/ru/rss' | |
}; | |
var request = require('http').request(query); | |
var chunks = []; | |
request.on('response', function(response) { | |
response.on('data', function(chunk) { | |
chunks.push(chunk); | |
}); | |
response.on('end', function() { | |
test(); | |
}); | |
}); | |
request.end(); | |
var zlib = require("zlib") | |
function test () { | |
// now we have the data, and can zlib it again and again, testing | |
// for any memory increase over time. | |
console.log(process.memoryUsage()); | |
var unzip = new zlib.Unzip(); | |
// run the test again after ending. | |
unzip.on("end", test) | |
chunks.forEach(function (chunk) { | |
unzip.write(chunk); | |
}); | |
unzip.end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment