Refactor code structure for improved readability and maintainability
This commit is contained in:
13
backend/dist/src/services/archiveReader.js
vendored
13
backend/dist/src/services/archiveReader.js
vendored
@@ -114,7 +114,12 @@ async function streamArchiveEntry(filePath, entryPath, logger = console) {
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
resolve(proc.stdout);
|
||||
if (proc.stdout) {
|
||||
resolve(proc.stdout);
|
||||
}
|
||||
else {
|
||||
resolve(null);
|
||||
}
|
||||
};
|
||||
proc.once('error', onProcError);
|
||||
if (proc.stdout && proc.stdout.once) {
|
||||
@@ -152,7 +157,11 @@ async function streamArchiveEntry(filePath, entryPath, logger = console) {
|
||||
// Fallback for zip
|
||||
if (ext === 'zip') {
|
||||
try {
|
||||
const proc2 = (0, child_process_1.spawn)('unzip', ['-p', filePath, entryPath]);
|
||||
const proc2 = (0, child_process_1.spawn)('unzip', [
|
||||
'-p',
|
||||
filePath,
|
||||
entryPath,
|
||||
]);
|
||||
const stream2 = await waitForStreamOrError(proc2);
|
||||
if (stream2)
|
||||
return stream2;
|
||||
|
||||
Reference in New Issue
Block a user