I want to fetch image from azure blob storage and send it over to client without saving it locally. I am able to get image from blob storage and save it to local file but struggling to send it to client without saving locally. Please find code below
const containerClient = blobServiceClient.getContainerClient(containerName);
const blockBlobClient = containerClient.getBlobClient(blobName);
const downloadBlockBlobResponse = await blockBlobClient.download(0);
console.log('\nDownloaded blob content...');
let f = await streamToString(downloadBlockBlobResponse.readableStreamBody)
reply.type('image/jpg').send(f)
streamToString function is as follows
async function streamToString(readableStream) {
return new Promise((resolve, reject) => {
const chunks = [];
readableStream.on("data", (data) => {
chunks.push(data.toString());
});
readableStream.on("end", () => {
resolve(chunks.join(""));
});
readableStream.on("error", reject);
});
}
I get blank screen in browser when I run this code




