MCPcopy Index your code
hub / github.com/tensorflow/tfjs-examples / maybeExtract

Function maybeExtract

sentiment/data.js:172–186  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

170 * @param {string} destDir Extraction destination directory.
171 */
172async 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
188const ZIP_SUFFIX = '.zip';
189

Callers 2

maybeDownloadAndExtractFunction · 0.85
loadMetadataTemplateFunction · 0.85

Calls 1

extractFunction · 0.85

Tested by

no test coverage detected