Wednesday, 9 January 2019

saving binary image doesn't work

Hi, i send a request to an API which then responds with an image. I try to save it to a new png file.this is my code:const get = () => { axios(options).then((res) => { console.log(res.data); fs.writeFile('test.png', res.data, () => { console.log('saved') }) }) } get() The file gets created but somehow i am not able to view the image. Why is that?Thanks in advance ;)

Submitted January 09, 2019 at 06:01PM by everek123

No comments:

Post a Comment