Only require decompress-tarxz when needed
This commit is contained in:
parent
ffb0f84361
commit
4fb5a31c3b
|
@ -25,7 +25,6 @@ const child_process = require('child_process');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const ini = require('ini').parse;
|
const ini = require('ini').parse;
|
||||||
const decompress = require('decompress');
|
const decompress = require('decompress');
|
||||||
const decompressTarxz = require('decompress-tarxz')
|
|
||||||
|
|
||||||
function exec() {
|
function exec() {
|
||||||
const args = Array.from(arguments);
|
const args = Array.from(arguments);
|
||||||
|
@ -97,7 +96,7 @@ function download(serverFolder, archive, destination) {
|
||||||
|
|
||||||
function extract(downloadedArchive, targetFolder, archiveRootFolder) {
|
function extract(downloadedArchive, targetFolder, archiveRootFolder) {
|
||||||
console.log(`Extracting ${path.basename(downloadedArchive)} => ${targetFolder}`);
|
console.log(`Extracting ${path.basename(downloadedArchive)} => ${targetFolder}`);
|
||||||
const decompressOptions = /tar\.xz$/.test(downloadedArchive) ? { plugins: [ decompressTarxz() ] } : undefined;
|
const decompressOptions = /tar\.xz$/.test(downloadedArchive) ? { plugins: [ require('decompress-tarxz')() ] } : undefined;
|
||||||
if (!archiveRootFolder) {
|
if (!archiveRootFolder) {
|
||||||
return decompress(downloadedArchive, targetFolder, decompressOptions);
|
return decompress(downloadedArchive, targetFolder, decompressOptions);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue