Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Downloader

Hierarchy

  • Downloader

Index

Constructors

constructor

  • new Downloader(downloaderOptions?: {}): Downloader

Properties

Private bytesChecked

bytesChecked: number = 0

Private bytesDownloaded

bytesDownloaded: number = 0

Private bytesToCheck

bytesToCheck: number = 0

Private bytesToDownload

bytesToDownload: number = 0

Private checkProgress

checkProgress: number = 0

checksumAlgo

checksumAlgo: string = "sha256"

Private dispatcher

dispatcher: Dispatcher = new Dispatcher()

Private downloadProgress

downloadProgress: number = 0

Private Readonly downloaderOptions

downloaderOptions: {}

Type declaration

Private downloadersInProgress

downloadersInProgress: DownloaderHelper[] = []

Private downloadersQueue

downloadersQueue: DownloaderHelper[] = []

Private filesDownloaded

filesDownloaded: number = 0

Private filesToDownload

filesToDownload: number = 0

Private forceDownload

forceDownload: boolean = false

maxRetries

maxRetries: number = 3

Private progress

progress: number = 0

simultaneusDownloads

simultaneusDownloads: number = 5

state

state: DownloaderState = DownloaderState.STAND_BY

Methods

addFile

  • addFile(fileUrl: string, installPath: string, fileName?: string | null, checksum?: string | null): Downloader
  • Parameters

    • fileUrl: string
    • installPath: string
    • Default value fileName: string | null = null
    • Default value checksum: string | null = null

    Returns Downloader

Private checksumFile

  • checksumFile(downloader: any): Promise<unknown>

clean

  • clean(): void

Private dispatchProgress

  • dispatchProgress(stats: any): void

Private downloaderCompleted

  • downloaderCompleted(downloader: any, pass?: boolean): void
  • Parameters

    • downloader: any
    • Default value pass: boolean = false

    Returns void

Private isFileNeedUpdate

  • isFileNeedUpdate(downloader: any): Promise<boolean>

off

  • off(eventName: string, callback: (data: any) => void): Downloader
  • Parameters

    • eventName: string
    • callback: (data: any) => void
        • (data: any): void
        • Parameters

          • data: any

          Returns void

    Returns Downloader

on

  • on(eventName: string, callback: (data: any) => void): Downloader
  • Parameters

    • eventName: string
    • callback: (data: any) => void
        • (data: any): void
        • Parameters

          • data: any

          Returns void

    Returns Downloader

pause

  • pause(): void

Private removeDownloaderFromQueue

  • removeDownloaderFromQueue(downloader: any): boolean

resume

  • resume(): Promise<void>

start

  • start(forceDownload?: boolean): Promise<void>
  • Parameters

    • Default value forceDownload: boolean = false

    Returns Promise<void>

Private startDownloader

  • startDownloader(downloader: any): Promise<void>

Private startNextDownloader

  • startNextDownloader(): boolean

stats

  • stats(): { fileDownloaded: number; files: number; progress: number; progressCheck: number; progressDownload: number }
  • Returns { fileDownloaded: number; files: number; progress: number; progressCheck: number; progressDownload: number }

    • fileDownloaded: number
    • files: number
    • progress: number
    • progressCheck: number
    • progressDownload: number

stop

  • stop(): void

Generated using TypeDoc