dist/node-base64-image.js
function decode(imageBuffer) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { filename: 'saved-image' };
  var callback = arguments[2];
  // eslint-disable-line
  if (!_lodash2.default.isBuffer(imageBuffer)) {
    return callback(new Error('The image is not a Buffer object type'));
  }

  (0, _fs.writeFile)(options.filename + '.jpg', imageBuffer, 'base64', function (err) {
    if (err) {
      return callback(err);
    }

    return callback(null, 'Image saved successfully to disk!');
  });
}
function decode(imageBuffer) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { filename: 'saved-image' };
  var callback = arguments[2];
  // eslint-disable-line
  if (!_lodash2.default.isBuffer(imageBuffer)) {
    return callback(new Error('The image is not a Buffer object type'));
  }

  (0, _fs.writeFile)(options.filename + '.jpg', imageBuffer, 'base64', function (err) {
    if (err) {
      return callback(err);
    }

    return callback(null, 'Image saved successfully to disk!');
  });
}
function decode ( imageBuffer ) { var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { filename : 'saved-image' } ; var callback = arguments [ 2 ] ; // eslint-disable-line if ( ! _lodash2 . default . isBuffer ( imageBuffer ) ) { return callback ( new Error ( 'The image is not a Buffer object type' ) ) ; } ( 0 , _fs . writeFile ) ( options . filename + '.jpg' , imageBuffer , 'base64' , function ( err ) { if ( err ) { return callback ( err ) ; } return callback ( null , 'Image saved successfully to disk!' ) ; } ) ; }
Decodes an base64 encoded image buffer and saves it to disk

@name decode
@param {Buffer} imageBuffer - Image Buffer object
@param {Object} [options={}] - Options object for extra configuration
@param {string} options.filename - Filename for the final image file
@param {fnCallback} callback - Callback function
@return {fnCallback} - Returns the callback
Decodes an base64 encoded image buffer and saves it to disk