Running unzip directly in ubuntu command line:
ubuntu@ip-172-31-47-89:~/myapp/test-files$ unzip qwe-qwe-0001.zip
Archive: qwe-qwe-0001.zip
warning: stripped absolute path spec from /
mapname: conversion of failed
creating: 01-01-2000-30178/
creating: 01-01-2000-30178/3000566.000000-03192/
extracting: 01-01-2000-30178/3000566.000000-03192/1-006.dcm
extracting: 01-01-2000-30178/3000566.000000-03192/1-018.dcm
extracting: 01-01-2000-30178/3000566.000000-03192/1-051.dcm
extracting: 01-01-2000-30178/3000566.000000-03192/1-076.dcm
extracting: 01-01-2000-30178/3000566.000000-03192/1-103.dcm
...
unzipping is actually successful, but it shows this error message at the begining:
warning: stripped absolute path spec from /
mapname: conversion of failed
Now, when I use this command in my code, it acutually throws an error:
const { execSync } = require('child_process');
export const unzip = (zipFilePath, outputDirectory) => {
try {
// Construct the command
const command = `unzip -o ${zipFilePath} -d ${outputDirectory}`;
logger.info(`running command: ${command}`);
execSync(command);
logger.info(`Finished running the unzip command.`);
} catch (error) {
throw error;
}
}
How can I avoid the error throwing?
Since it is just a warning that the zip contains absolute path and it is handled by the library and the extraction is successful, it should not throw error and break the workflow in my app.