Downloader

new Downloader(options)

Creates a new Downloader instance.

Parameters:
NameTypeDescription
options

Configuration object.

Properties
NameTypeAttributesDescription
playlistURL

URL of the master HLS playlist.

destination<optional>

Output directory for downloaded files.

overwrite<optional>

Whether to overwrite existing files.

concurrency<optional>

Maximum concurrent downloads.

onData<optional>

Callback triggered on successful segment retrieval.

onError<optional>

Callback triggered on failure.

Author
  • Nur Rony<pro.nmrony@gmail.com> The main orchestrator service for managing HLS stream acquisition.

Methods

(async) downloadFile(url)

Downloads and saves a single file.

Parameters:
NameTypeDescription
url

Resource URL to download.

Author
  • Nur Rony<pro.nmrony@gmail.com>
Returns:

generateSummary()

Generates a structured summary of the download operation.

Author
  • Nur Rony<pro.nmrony@gmail.com>
Returns:
  • DownloadSummary

handleError(url, error)

Handles and aggregates download errors.

Parameters:
NameTypeDescription
url

URL that caused the error.

error

The thrown error.

Author
  • Nur Rony<pro.nmrony@gmail.com>

(async) processQueue()

Processes all queued URLs using controlled concurrency.

Author
  • Nur Rony<pro.nmrony@gmail.com>
Returns:
  • Promise<any | unknow>

(async) startDownload() → {Promise.<DownloadSummary>}

Initiates the download lifecycle.

Author
  • Nur Rony<pro.nmrony@gmail.com>
Returns:
  • DownloadSummary
Type: 
Promise.<DownloadSummary>