UNPKG

@acurast/cli

Version:

A cli to interact with the Acurast Cloud.

21 lines 758 B
import { readFileSync, writeFileSync } from 'fs'; import { ensureDirectoryExistence } from '../util/ensureDirectoryExistence.js'; import { ACURAST_BASE_PATH } from '../constants.js'; const file = `${ACURAST_BASE_PATH}/live-code-processors.json`; export const readLiveCodeProcessors = () => { return (() => { try { return JSON.parse(readFileSync(file, 'utf8')); } catch (e) { return []; } })(); }; export const addLiveCodeProcessor = (processor) => { ensureDirectoryExistence(file); const liveCodeProcessors = readLiveCodeProcessors(); liveCodeProcessors.unshift(processor); writeFileSync(file, JSON.stringify(liveCodeProcessors, null, 2)); }; //# sourceMappingURL=storage.js.map