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

Function loadMetadataTemplate

sentiment/data.js:246–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244 * @return A JSON object that is the metadata template.
245 */
246export async function loadMetadataTemplate() {
247 const baseName = path.basename(METADATA_TEMPLATE_URL);
248 const zipDownloadDest = path.join(os.tmpdir(), baseName);
249 await maybeDownload(METADATA_TEMPLATE_URL, zipDownloadDest);
250
251 const zipExtractDir =
252 zipDownloadDest.slice(0, zipDownloadDest.length - ZIP_SUFFIX.length);
253 await maybeExtract(zipDownloadDest, zipExtractDir);
254
255 return JSON.parse(fs.readFileSync(
256 path.join(zipExtractDir,
257 baseName.slice(0, baseName.length - ZIP_SUFFIX.length))));
258}

Callers 1

mainFunction · 0.90

Calls 2

maybeExtractFunction · 0.85
maybeDownloadFunction · 0.70

Tested by

no test coverage detected