mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 20:51:30 +03:00
Fixed downloads causing crashes. Better Docs
This commit is contained in:
parent
9574095696
commit
2652654c18
3 changed files with 17 additions and 15 deletions
|
@ -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();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue