Constructor
new Downloader(downloderOptions)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
downloderOptions | object | Options to build downloader Properties
|
- Source
TypeError
ProtocolNotSupported
Members
concurrency :number
Concurrency limit to download items
- number
- Default Value
- 1
- Source
defaultKyOptions :object
Default Ky options values set by HLSDownloader
- object
- Default Value
{ retry: { limit: 0 } }
- Source
destination :string
Absolute path to download the TS files with corresponding playlist file
- string
- Default Value
- ''
- Source
errors :Array.<{url: string, name: string, message: string}>
items that are not downloaded successfully
- Array.<{url: string, name: string, message: string}>
- Source
items :Array.<string>
items that are downloaded successfully
- Array.<string>
- Source
kyOptions :object
Extra options to pass into Ky
- object
- Default Value
{}
- Source
onData :function|null
Function to track downloaded data
- function |
null
- Default Value
- null
- Source
onError :function|null
Function to track error
- function |
null
- Default Value
- null
- Source
overwrite :boolean
concurrency controller
- boolean
- Default Value
- false
- Source
playlistURL :string
Playlist URL to download
- string
- Default Value
- ''
- Source
pool :object
concurrency controller
- object
- Default Value
- 1
- Source
unSupportedOptions :Array.<string>
- Array.<string>
- Default Value
[ 'uri', 'url', 'json', 'form', 'body', 'method', 'setHost', 'isStream', 'parseJson', 'prefixUrl', 'cookieJar', 'playlistURL', 'concurrency', 'allowGetBody', 'stringifyJson', 'methodRewriting' ]
- Source
Methods
(async) createDirectory(url) → {Promise.<string>}
create directory to download
Name | Type | Description |
---|---|---|
url | string | url to construct the path from |
- Source
destination path
- Type:
- Promise.<string>
(async) downloadItem(item) → {Promise.<any>}
Download each iteam
Name | Type | Description |
---|---|---|
item | string | item to download |
- Source
- Type:
- Promise.<any>
(async) downloadItems() → {Promise.<any>}
Download playlist and items
- Source
- Type:
- Promise.<any>
(async) fetchItems() → {Promise.<any>}
Fetch playlist items
- Source
- Type:
- Promise.<any>
(async) fetchPlaylist() → {Promise.<{url, body}>}
fetch playlist content
- Source
- Type:
- Promise.<{url, body}>
formatPlaylistContent(playlistContentResults) → {Array.<{url: string, body: string}>}
filter playlist contents
Name | Type | Description |
---|---|---|
playlistContentResults | Array.<object> | list of fetched playlist content |
- Source
list of object containing url and its content
- Type:
- Array.<{url: string, body: string}>
mergeOptions(options) → {object}
merge options
Name | Type | Description |
---|---|---|
options | object |
- Source
- Type:
- object
parsePlaylist(playlistContent)
Parse playlist content and index the TS chunk to download.
Name | Type | Description |
---|---|---|
playlistContent | string |
- Source
string[] Array of url
(async) processPlaylistItems() → {Promise.<any>}
Process playlist items
- Source
- Type:
- Promise.<any>
(async) shouldOverwrite(url) → {Promise.<boolean>}
Checks for overwrite flag
Name | Type | Description |
---|---|---|
url | string | url to build path from |
- Source
- Type:
- Promise.<boolean>