Tried to upload an image using Base64 but if the string is long the bottom of the stored image is blank white.
upload.js
var uuid = require('node-uuid');
var fs = require('fs');
exports.uploadImage = function(base64Str, callback) {
var filename = uuid.v1()+'.png';
var bitmap = new Buffer(base64Str, 'base64');
fs.writeFileSync(filename, bitmap);
callback(filename);
};
server.js
var fs = require('fs');
var restify = require('restify');
var server = restify.createServer();
server.use(restify.bodyParser());
var upload = require('./modules/upload');
server.post('/images', function(req, res) {
upload.uploadImage(req.params.myImage, function(filename) {
console.log('processing image');
res.send(filename);
res.end();
});
});
server.listen(3000);
It works for a string of length 499016 bytes but not if the string is 847508 bytes. Is there a documented size limit and, if not, how can I upload and un-encode longer strings?