0

I am using this code to download image from google cloud storage using this code.

request(googleUrl).pipe(response);

My requirement is to change the image to binary and send over network.

P.S how to change the above code to promise as well.

Kindly please help

1 Answers1

0

you can send binary file like below

const img = fs.readFileSync("imagePath");
res.writeHead(200, { "Content-Type": "image/gif" });
res.end(img, "binary");
S.Polat
  • 71
  • 8