hydra/src/main/events/helpers/get-downloads-path.ts
2025-02-01 19:11:58 +00:00

16 lines
456 B
TypeScript

import { defaultDownloadsPath } from "@main/constants";
import { db, levelKeys } from "@main/level";
import type { UserPreferences } from "@types";
export const getDownloadsPath = async () => {
const userPreferences = await db.get<string, UserPreferences | null>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
if (userPreferences?.downloadsPath) return userPreferences.downloadsPath;
return defaultDownloadsPath;
};