UNPKG

@leda-mint-io/candymachine-client-sdk

Version:

Metaplex Candy Machine Client SDK

44 lines (43 loc) 1.5 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.saveCache = void 0; const js_file_download_1 = __importDefault(require("js-file-download")); // export function cachePath( // env: string, // cacheName: string, // cPath: string = CACHE_PATH, // legacy: boolean = false, // ) { // const filename = `${env}-${cacheName}`; // return path.join(cPath, legacy ? filename : `${filename}.json`); // } // export function loadCache( // cacheName: string, // env: string, // cPath: string = CACHE_PATH, // legacy: boolean = false, // ) { // const path = cachePath(env, cacheName, cPath, legacy); // if (!fs.existsSync(path)) { // if (!legacy) { // return loadCache(cacheName, env, cPath, true); // } // return undefined; // } // return JSON.parse(fs.readFileSync(path).toString()); // } /** * Save the cache to the cache path. * @param cacheName The name of the cache to save. * @param env The environment used 'mainnet-beta' | 'devnet' | 'testnet' * @param cacheContent The content of the cache to save. */ function saveCache(cacheName, env, cacheContent) { cacheContent.env = env; cacheContent.cacheName = cacheName; (0, js_file_download_1.default)(JSON.stringify(cacheContent), cacheName); } exports.saveCache = saveCache;