MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / getSettings

Function getSettings

main.js:8793–8820  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8791 preview3mfCache.set(cacheKey, cached);
8792 if (shouldCleanup && actualFilePath !== filePath) {
8793 try { await fs.promises.unlink(actualFilePath); } catch {}
8794 }
8795 return normalizePreview3mfTypedArrays(cached);
8796 }
8797
8798 // Disk cache
8799 if (cachePath) {
8800 try {
8801 await fs.promises.mkdir(cacheDir, { recursive: true });
8802 const cacheStat = await fs.promises.stat(cachePath);
8803 if (cacheStat.size <= PREVIEW_3MF_MAX_DISK_CACHE_MB * 1024 * 1024) {
8804 const cachedJson = await fs.promises.readFile(cachePath, 'utf8');
8805 const parsed = normalizePreview3mfTypedArrays(JSON.parse(cachedJson));
8806 preview3mfCache.set(cacheKey, parsed);
8807 trimPreview3mfMemoryCache();
8808 if (shouldCleanup && actualFilePath !== filePath) {
8809 try { await fs.promises.unlink(actualFilePath); } catch {}
8810 }
8811 return parsed;
8812 }
8813 try { await fs.promises.unlink(cachePath); } catch {}
8814 } catch (error) {
8815 if (error && error.code !== 'ENOENT') {
8816 console.error('Error reading 3MF preview cache:', error);
8817 }
8818 }
8819 }
8820
8821 return new Promise((resolve, reject) => {
8822 const workerPath = path.join(__dirname, 'preview-3mf-worker-node.js');
8823 const entry = { worker: createPreview3mfWorker(workerPath) };

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected