diff --git a/Gruntfile.js b/Gruntfile.js index 203d6f5a9a..1b6510fb86 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -839,8 +839,11 @@ var _ = require('lodash'), downloadImagePromise = function (url, name) { return new Promise(function (resolve, reject) { - https.get(url, function (res) { - fs.writeFile(imagePath + name, res, function () { + var file = fs.createWriteStream(path.join(__dirname, imagePath, name)); + https.get(url, function (response) { + response.pipe(file); + file.on('finish', function () { + file.close(); resolve(); }); })