Make a png file with fs

I have a png file and the response is its value in like the random characters that make up an png, and i need to use fs.writeFileSync to make a png with it. how do I turn the random characters into a png file I can make?

Hey @Cald-fan, maybe this Stack Overflow answer will point you in the right direction.

(I’m moving this to the coding help section of the forums as it’s not really a question about Glitch, and you’ll probably get more help there! :slight_smile:)

Would there be a way to use express and send an image without creating the image then sending the file?

fs.writeFileSync("revenue.png", encoded.data, "binary") tried that, it created the file but it is the image not loaded image, the little picture icon

Hey @Cald-fan, can you share a Glitch project or some code to look at? It’s not clear to me what you’re trying to do.