-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new advance section and example
- Loading branch information
Showing
3 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
import HLSDownloader from './build/index'; | ||
|
||
const downloader = new HLSDownloader({ | ||
// for fetching | ||
let downloader = new HLSDownloader({ | ||
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
concurrency: 5, | ||
destination: '/tmp/test', | ||
}); | ||
|
||
const download = async () => downloader.startDownload(); | ||
console.log(await downloader.startDownload()); | ||
|
||
// download HLS resoruces | ||
downloader = new HLSDownloader({ | ||
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
destination: '/tmp/tests', | ||
}); | ||
|
||
// with 5 parallel download | ||
downloader = new HLSDownloader({ | ||
concurrency: 5, | ||
destination: '/tmp/tests', | ||
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
}); | ||
|
||
// force overwrite | ||
downloader = new HLSDownloader({ | ||
concurrency: 5, | ||
overwrite: true, | ||
destination: '/tmp/tests', | ||
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
}); | ||
|
||
// passing ky option | ||
downloader = new HLSDownloader({ | ||
concurrency: 5, | ||
overwrite: true, | ||
destination: '/tmp/tests', | ||
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
retry: { limit: 0 }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters