I am trying to create a multi threaded downloader using nodejs. Currently I am only able to download the file using a single thread. Its a simple http.get request in nodejs.
To create a multi threaded downloader I will have to send some http headers in my request which I am not able to figure out some how. I want to know what http headers should I be sending so that I am able to download a range of bytes from an offset.
var http = require('http');
var options = {
host: 'hostname.com',
path: '/path/to/a/large/file.zip',
headers: {
//Some headers which will help me download only a part of the file.
}
};
callback = function(response) {
response.on('data', function (chunk) {
//write chunk to a file
});
}
http.request(options, callback).end();