// Download speed limit (Settings → Downloads). Shared by the settings API and the worker. export const SPEED_LIMIT_KEY = "downloads.maxBytesPerSecond"; /** Smallest limit accepted (0.1 MB/s); below that hf's own timeouts start to bite. */ export const MIN_SPEED_LIMIT = 100_000; /** The stored value as bytes per second, or null for no limit. */ export function parseSpeedLimit(v: unknown): number | null { return typeof v === "number" && Number.isFinite(v) && v >= MIN_SPEED_LIMIT ? v : null; }