Я использую node.js для сохранения холста к изображению img в writeFile извлекается с помощью toDataURL на моем элементе canvas. сохранить файл doenot вот мой код
var fs = IMPORTS.require('fs');
var path = IMPORTS.require('path');
path.exists('images/', function(exists){
if (exists) {
fs.writeFile('images/icon.png', img, function(err){
if (err)
callback({
error: false,
reply: err
});
console.log('Resized and saved in');
callback({
error: false,
reply: 'success.'
});
});
}
else {
callback({
error: true,
reply: 'File did not exist.'
});
}
});