var fs = require('fs');
var base64 = 'MTIz'; // String with ZIP source in base64.
var path = './original.zip'
, buffer = new Buffer(base64, 'base64');
fs.open(path, 'w', function (error, file) {
if (error) {
throw 'Error opening file: ' + error;
}
fs.write(file, buffer, 0, buffer.length, null, function (error) {
if (error) throw 'Error writing file: ' + error;
fs.close(file, function () {
console.log('File written');
})
});
});
Комментариев нет:
Отправить комментарий