Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 4x 4x 4x 4x 4x 4x 4x 4x 4x 20x 20x 20x 20x 2x 20x | import { readFile } from 'node:fs/promises' import { join as pathJoin } from 'node:path' import { LOCAL_STORE_FILE } from '../commons/constants' import type { IListStore } from '../interfaces/store.interfaces' import { logger } from '../log/logger' import { existsAndIsFile } from '../utils/file.utils' import { Store } from './Store' const STORE_FILE = pathJoin(__dirname, '..', LOCAL_STORE_FILE) const EMPTY_STORE: IListStore = { linux: { x64: [], x86: [], }, mac: { x64: [], arm: [], }, win: { x64: [], x86: [], }, } export async function loadStore(): Promise<Store> { logger.debug(`using store file: ${STORE_FILE}`) const currentStoreJson = await existsAndIsFile(STORE_FILE) ? await readFile(STORE_FILE, 'utf8') : JSON.stringify(EMPTY_STORE) let currentStore: IListStore try { currentStore = JSON.parse(currentStoreJson) } catch { currentStore = EMPTY_STORE } return new Store(currentStore) } |