Skip to content

Commit

Permalink
fix(downloader): add onData hook for fetch item
Browse files Browse the repository at this point in the history
now fetch items also calls onData hook fine

closes #158
  • Loading branch information
nurrony committed Mar 23, 2024
1 parent 9f6bc2e commit d9c5fec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,11 @@ class Downloader {
this.items.map(item =>
this.pool(async () => {
try {
return await ky.get(item, { ...this.kyOptions });
const item$ = await ky.get(item, { ...this.kyOptions });
if (this.onData) {
this.onData({ url: item, totalItems: this.items.length, path: null });
}
return item$;
} catch ({ name, message }) {
this.errors.push({ url: item, name, message });
}
Expand Down

0 comments on commit d9c5fec

Please sign in to comment.