Skip to content

Instantly share code, notes, and snippets.

@bartt
Created November 7, 2010 22:24
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 bartt/666928 to your computer and use it in GitHub Desktop.
Save bartt/666928 to your computer and use it in GitHub Desktop.
var fs = require('fs');
fs.readFile('some-image.jpg', function(err, data){
// Does write base64 encoded data
fs.writeFile('some-image1.txt', data.toString('base64'), function(err){})
// Does NOT write base64 encoded data. The file is identical to some-image.jpg
fs.writeFile('some-image2.txt', data, 'base64', function(err){});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment