http.createServer(function (req,res){
if(req.url==="/path/" || req.url==="/path")
{
var request = http.get(options, function(rres){
var imagedata = '';
rres.setEncoding('base64');
rres.on('data', function(chunk){
imagedata += chunk;
});
var buffer=new Buffer(imagedata,'base64');
rres.on('end', function(){
var buffer=new Buffer(imagedata,'base64');
doc.image(buffer,0,0);
doc.pipe(res);
doc.end();
})
})
}
}).listen(8167);