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 | 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { fetchLocalStore } from '../api'
import { LOAD_CONFIG } from '../commons/loggerTexts'
import type { IStoreConfig } from '../interfaces/interfaces'
import { spinner } from '../log/spinner'
import { Store } from './Store'
/**
* Downloads the localstore.json file an places it in the work directory of rusted chromium.
* Adds "localstore.json" to the URL if it's not present
* @param url
*/
export async function downloadStore(config: IStoreConfig, destinationPath: string): Promise<Store> {
let url = config.url
if (!url.endsWith(destinationPath)) {
if (!url.endsWith('/')) {
url += '/'
}
url = `${url}${destinationPath}`
}
spinner.start(LOAD_CONFIG)
return fetchLocalStore(url).then(storeFile => {
spinner.success()
return new Store(storeFile)
}).catch(err => {
spinner.error()
if (err?.message && err.path) {
spinner.error(`${err.message}: ${err.path}`)
} else {
spinner.error(err)
}
throw err
})
}
|