I would like to send a Windows Azure Blob (an image) directly to the client ; I am trying this :
blobService.getBlobToStream('images', req.url, res, function(err, blob) {
if (!err) {
res.writeHead(200, { 'Content-Type': blob.contentType });
} else {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(err);
}
});
I am trying to pipe the Blob stream directly to the response stream ; should this work ? In Firefox, I get a message : “The image cannot be displayed because it contains errors”. Looking at Firebug, the size of the image is 0.
This seems to work prefectly for me (if this is any help?):
Update
Just figured it out.
req.urlwill have a leading slash (/). Which I’m guessing will not match your image filename.