Skip to content

Instantly share code, notes, and snippets.

@jeonghwan-kim
Created March 6, 2014 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeonghwan-kim/9391056 to your computer and use it in GitHub Desktop.
Save jeonghwan-kim/9391056 to your computer and use it in GitHub Desktop.
usage base64 in nodejs
fs.readFile(image_origial, function(err, original_data){
fs.writeFile('image_orig.jpg', original_data, function(err) {});
var base64Image = original_data.toString('base64');
var decodedImage = new Buffer(base64Image, 'base64');
fs.writeFile('image_decoded.jpg', decodedImage, function(err) {});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment