My Node.js server has something that looks like the following:
app.get(\"/api/id/:w\", function(req, res) { var data = getIcon(req.params.w); });
I had to do a bit of manipulation first to get mine in the right format, but this worked great:
var base64Data = data.replace(/^data:image\/png;base64,/, '');