-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It was using the wrong unzipping library, now we can just use the wget-improved and AdmZip local wrappers
- Loading branch information
1 parent
ecede83
commit a8985a6
Showing
2 changed files
with
9 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,13 @@ | ||
const path = require("path") | ||
const wget = require("wget-improved") | ||
const fs = require("fs") | ||
const unzipper = require("unzipper") | ||
const { exit } = require("./util") | ||
const { exit, asyncDownload, asyncExtract } = require("./util") | ||
|
||
module.exports = async () => { | ||
var link = `https://dl.issou.best/ordr/client-latest.zip` | ||
const output = path.resolve("files/client-latest.zip") | ||
let link = `https://dl.issou.best/ordr/client-latest.zip` | ||
const outputZip = path.resolve("files/client-latest.zip") | ||
|
||
let download = wget.download(link, output) | ||
download.on("error", async err => { | ||
console.log(err) | ||
await exit() | ||
}) | ||
download.on("start", fileSize => { | ||
console.log(`Downloading the client update at ${link}, ${fileSize} bytes to download...`) | ||
}) | ||
download.on("end", async () => { | ||
try { | ||
fs.createReadStream(output) | ||
.pipe( | ||
unzipper.Extract({ | ||
path: `.` | ||
}) | ||
) | ||
.on("close", async () => { | ||
console.log(`Finished updating the client. You can now restart it.`) | ||
await exit() | ||
}) | ||
} catch (err) { | ||
console.log("An error occured while unpacking: " + err) | ||
await exit() | ||
} | ||
}) | ||
await asyncDownload(link, outputZip, "client-latest", "file") | ||
await asyncExtract(outputZip, ".", "client-latest", "file") | ||
|
||
console.log("Finished updating the client. You can now restart it.") | ||
await exit() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters