Created
June 29, 2011 05:11
-
-
Save ghiden/1053196 to your computer and use it in GitHub Desktop.
decode a base64 encoded image file with node.js
This file contains hidden or 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'), | |
decode64 = require('base64').decode; | |
var data = fs.readFileSync('./encode.png', 'base64'); | |
var buffer = new Buffer(data, 'base64'); | |
fs.writeFileSync('./decode.png', decode64(buffer), 'binary') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cannot find module 'base64'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:
node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.