Skip to content
This repository has been archived by the owner on Apr 24, 2021. It is now read-only.

Commit

Permalink
cache file stuff (for refresh)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Dec 28, 2020
1 parent 309f49b commit 8a32483
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import * as fs from "fs-extra";
import E621Downloader from "e621downloader.js";
import progress from "cli-progress";
import ms from "e621downloader.js/build/src/util/Time";
import path from "path";

export default class Refresh {
static async run() {
const cnf = ConfigManager.get();
if (!cnf.useCache) throw new TypeError("Cache is not enabled. Launch the app, go to settings, enable it, and download some tags.");
if (!fs.existsSync(`${cnf.saveDirectory}/cache.json`)) throw new TypeError("Cache file not found.");
const v = path.resolve(`${cnf.saveDirectory}${cnf.saveDirectory.endsWith("E621Downloader/Files") ? "/.." : ""}/cache.json`);
console.log("Looking for cache file at:", v);
if (!fs.existsSync(v)) throw new TypeError("Cache file not found.");
const e = new E621Downloader({
...cnf,
cacheFile: `${cnf.saveDirectory}/cache.json`
cacheFile: v
});
const p = new progress.SingleBar({
hideCursor: true
Expand Down

0 comments on commit 8a32483

Please sign in to comment.