Node.js Base64 Image decoding and writing to file

apache-flex, base64, decoding, image, node.js

Solution

Try removing the `.toString()` entirely and just write the buffer directly.

Problem

I'm sending the contents of this Flex form (Don't ask why) over to node. There is a post paramteter called "photo" which is a base64 encoded image. Contents of photo get sent over ok. Problem is when I am trying to decode the content and write them to a file. ``` var fs = require("fs"); fs.writeFile("arghhhh.jpg", new Buffer(request.body.photo, "base64").toString(), function(err) {}); ``` I've tried toString("binary") as well. But it seems node doesnt decode all of the content. It seems it only decodes jpg header info and leaves the rest. Can anyone please help me with this? Thanks

Original source

Related problems