Fixed downloads causing crashes. Better Docs

This commit is contained in:
Pierce 2019-02-10 21:21:14 -05:00
parent 9574095696
commit 2652654c18
3 changed files with 17 additions and 15 deletions

View file

@ -25,8 +25,11 @@ function downloadAsync (url, directory, name) {
});
_request.on('data', (data) => {
let size = 0;
if(fs.existsSync(path.join(directory, name))) size = fs.statSync(path.join(directory, name))["size"];
event.emit('download-status', {
"current": Math.round(fs.statSync(path.join(directory, name))["size"] / 10000),
"name": name,
"current": Math.round(size / 10000),
"total": data.length
})
});
@ -35,7 +38,7 @@ function downloadAsync (url, directory, name) {
_request.pipe(file);
file.once('finish', function() {
console.log("Downloaded: " + name);
event.emit('download', name);
resolve({failed: false, asset: null});
});
});
@ -289,4 +292,4 @@ module.exports.extractPackage = function(root, clientPackage) {
event.emit('package-extract', true);
resolve();
});
};
};