Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add lifecycle hooks #4

Closed
jingyuexing opened this issue Jul 11, 2023 · 3 comments
Closed

feat: Add lifecycle hooks #4

jingyuexing opened this issue Jul 11, 2023 · 3 comments

Comments

@jingyuexing
Copy link

like this:

import { 
      downloadFailed,
      downloadAborted,
      downloadCompleted,
      connectFailed
} from 'maria2'

downloadFailed((e)=>{
console.log(e.reason,e.filename,e.filesize,e.progress)
})
@hydrati
Copy link
Owner

hydrati commented Jul 11, 2023

See https://aria2.github.io/manual/en/html/aria2c.html#notifications

This library is just a simple low-level client implementation.

@hydrati hydrati closed this as completed Jul 11, 2023
@yjl9903
Copy link
Contributor

yjl9903 commented Jul 11, 2023

I want to build a high-level abstract of aria2 based on this.

Maybe you can help :)

I think there should be a class Aria2Client with a download method, like the following prototype:

download(<magnet/torrent file/...>,
  options: { ..., callbacks: { progress(percent) {}, ... } }): Promise<{ status: 'ok' | 'aborted' | 'failed' | ..., ... }>

By the way, I have tried implementing this here

@jingyuexing
Copy link
Author

impl #8

@hydrati hydrati mentioned this issue Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants