1var options = {
2 method: 'GET',
3 host: 'localhost',
4 port: port,
5 path: '/file'
6 };
7
8var request = http.request(options, function(response) {
9 var data = [];
10
11 response.on('data', function(chunk) {
12 data.push(chunk);
13 });
14
15 response.on('end', function() {
16 data = Buffer.concat(data); // do something with data
17 });
18});
19
20request.end();
21