BlueSky & more on desktop
lazurite.stormlightlabs.org/
tauri
rust
typescript
bluesky
appview
atproto
solid
1import { normalizeError } from "$/lib/utils/text";
2
3export function filenameFromPath(path: string) {
4 const parts = path.split(/[/\\]/u);
5 return parts.at(-1) || "downloaded file";
6}
7
8export function toDownloadErrorMessage(error: unknown, fallback: string) {
9 const message = normalizeError(error);
10 if (/download folder|writable|save|directory|exists/iu.test(message)) {
11 return "Couldn't save — check that the download folder exists.";
12 }
13
14 return fallback;
15}