Skip to content

Commit

Permalink
chore(example): update example.js file
Browse files Browse the repository at this point in the history
add onData hook example in exmaple.js

closes #147
  • Loading branch information
nurrony committed Mar 20, 2024
1 parent a7e02b9 commit 2eef599
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ downloader = new HLSDownloader({
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
retry: { limit: 0 },
});

// passing onData hook
downloader = new HLSDownloader({
concurrency: 5,
overwrite: true,
destination: '/tmp/tests',
playlistURL: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
retry: { limit: 0 },
onData: function (data) {
console.log(
'downloaded item = ',
data.item,
', total items to download',
data.total,
', downloaded path =',
data.path
);
},
});

0 comments on commit 2eef599

Please sign in to comment.