I'm getting image via line api. when user send image to my bot, I will get it, and upload to aws s3 bucket: GET https://api.line.me/v2/bot/message/{messageId}/content
I got success image. I'm using file = fs.createWriteStream("file.jpg")
and pipe(file)
. However, it will be fixed at file extension "jpg". For example, the file I get has the extension "gif", it will still save in the format "jpg".
So, how to get image format, if I know image format, i can use fs.createWriteStream to create file have the same format.