i'd sugest to look in to https://github.com/mikeal/request wich is able to 
handle that for you.

Am Mittwoch, 9. Oktober 2013 07:46:29 UTC+2 schrieb James:
>
> Hi,
>
> I want to download a set of links using nodejs.  Which I am currently 
> achieving by looping following function.
>
> var http = require("http");
>
> function download(url, callback) {
>   http.get(url, function(res) {
>     var data = "";
>     res.on('data', function (chunk) {
>       data += chunk;
>     });
>     res.on("end", function() {
>       callback(data);
>     });
>   }).on("error", function() {
>     callback(null);
>   });
> }
>
> download(link_name,function(data) {
>     if (data) {
>     fs.writeFile(outputfile,data);
>     }else console.log("error"); 
> });
>
> *My question:* is there a way to keep the session alive? 
> For e.g. If I visit link1 and then link2.. how to keep the information of 
> link1 (session or any cookies) when I'm visiting the link2 ?
>
> Thanks !
> James.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to