Only require decompress-tarxz when needed

This commit is contained in:
Yavor Georgiev 2017-09-30 16:35:46 +02:00
parent ffb0f84361
commit 4fb5a31c3b
No known key found for this signature in database
GPG Key ID: 83FC145DA0CCA9C3
1 changed files with 1 additions and 2 deletions

View File

@ -25,7 +25,6 @@ const child_process = require('child_process');
const fetch = require('node-fetch');
const ini = require('ini').parse;
const decompress = require('decompress');
const decompressTarxz = require('decompress-tarxz')
function exec() {
const args = Array.from(arguments);
@ -97,7 +96,7 @@ function download(serverFolder, archive, destination) {
function extract(downloadedArchive, targetFolder, archiveRootFolder) {
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) {
return decompress(downloadedArchive, targetFolder, decompressOptions);
} else {