Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript
662 B
Raw Blame
/* General file transfer/download utility types */

export type FileEntry =
  | {
      type: 'file'
      key: string
      name: string
    }
  | {
      type: 'directory'
      prefix: string
      name: string
    }

export type DownloadProgress = {
  downloaded_bytes: number
  total_bytes: number
  percentage: number
  speed: string
  time_remaining: number
}

export type DownloadOptions = {
  max_retries?: number
  retry_delay?: number
  chunk_size?: number
  timeout?: number
  onError?: (error: Error) => void
  onComplete?: (filepath: string) => void
}

export type DownloadRemoteSuccessCallback = (urls: string[], restart: boolean) => Promise<void>