mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-22 04:06:21 +03:00
Get package from url
This commit is contained in:
parent
2b6fa2a973
commit
2f0c3b3c44
2 changed files with 8 additions and 2 deletions
|
@ -3,6 +3,7 @@ const shelljs = require('shelljs');
|
|||
const path = require('path');
|
||||
const request = require('request');
|
||||
const zip = require('adm-zip');
|
||||
const event = require('./events');
|
||||
|
||||
|
||||
function downloadAsync (url, directory, name) {
|
||||
|
@ -220,8 +221,13 @@ module.exports.makePackage = async function(versions, os) {
|
|||
};
|
||||
|
||||
module.exports.extractPackage = function(root, clientPackage) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise(async resolve => {
|
||||
if(clientPackage.startsWith('http')) {
|
||||
await downloadAsync(clientPackage, root, "clientPackage.zip")
|
||||
clientPackage = path.join(root, "clientPackage.zip")
|
||||
}
|
||||
new zip(clientPackage).extractAllTo(root, true);
|
||||
event.emit('package-extract', true);
|
||||
resolve();
|
||||
});
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"description": "Module that downloads Minecraft assets and runs Minecraft.",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue