* Get extracted files. * * If the files are already extracted, this will be a no-op. * * @param {string} sourcePath Source zip file path. * @param {string} destDir Extraction destination directory.
(sourcePath, destDir)
| 170 | * @param {string} destDir Extraction destination directory. |
| 171 | */ |
| 172 | async function maybeExtract(sourcePath, destDir) { |
| 173 | return new Promise((resolve, reject) => { |
| 174 | if (fs.existsSync(destDir)) { |
| 175 | return resolve(); |
| 176 | } |
| 177 | console.log(`Extracting: ${sourcePath} --> ${destDir}`); |
| 178 | extract(sourcePath, {dir: destDir}, err => { |
| 179 | if (err == null) { |
| 180 | return resolve(); |
| 181 | } else { |
| 182 | return reject(err); |
| 183 | } |
| 184 | }); |
| 185 | }); |
| 186 | } |
| 187 | |
| 188 | const ZIP_SUFFIX = '.zip'; |
| 189 |
no test coverage detected