Created
November 7, 2010 22:24
-
-
Save bartt/666928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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