Commit a96136b3 authored by nanahira's avatar nanahira

use tar -I

parent 3f7750af
...@@ -17,6 +17,7 @@ import { createHash } from 'crypto'; ...@@ -17,6 +17,7 @@ import { createHash } from 'crypto';
import PQueue from 'p-queue'; import PQueue from 'p-queue';
import { LockService } from 'src/lock/lock.service'; import { LockService } from 'src/lock/lock.service';
import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis';
import { getZstdParams } from './zstd-params';
interface FileWithHash { interface FileWithHash {
file: readdirp.EntryInfo; file: readdirp.EntryInfo;
...@@ -119,7 +120,7 @@ export class PackagerService extends ConsoleLogger { ...@@ -119,7 +120,7 @@ export class PackagerService extends ConsoleLogger {
this.log(`Extracting package to ${extractRoot}.`); this.log(`Extracting package to ${extractRoot}.`);
stream.resume(); stream.resume();
//stream.on('data', (data) => this.log(`data => ${data}`)); //stream.on('data', (data) => this.log(`data => ${data}`));
await this.spawnAsync('tar', ['--zstd', '-xf', '-'], { cwd: extractRoot }, stream); await this.spawnAsync('tar', [...getZstdParams(), '-xf', '-'], { cwd: extractRoot }, stream);
this.log(`Package extracted to ${extractRoot}.`); this.log(`Package extracted to ${extractRoot}.`);
...@@ -231,7 +232,7 @@ export class PackagerService extends ConsoleLogger { ...@@ -231,7 +232,7 @@ export class PackagerService extends ConsoleLogger {
const files = archiveTask.filePaths; const files = archiveTask.filePaths;
this.log(`Packaging archive ${archiveName} with ${archiveTask.exactFilePaths.length} files.`); this.log(`Packaging archive ${archiveName} with ${archiveTask.exactFilePaths.length} files.`);
const child = child_process.spawn('tar', ['--zstd', '-cf', '-'].concat(files), { const child = child_process.spawn('tar', [...getZstdParams(), '-cf', '-'].concat(files), {
cwd: root, cwd: root,
}); });
const childPromise = new Promise<void>((resolve, reject) => { const childPromise = new Promise<void>((resolve, reject) => {
......
export const getZstdParams = () => ['-I', 'zstd -T0']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment