tusharmath / Multi-threaded-downloader

A http file downloader made in nodejs
MIT License
194 stars 90 forks source link

basic auth in options? #165

Closed pantchox closed 7 years ago

pantchox commented 7 years ago

how do you implement this in mtd?

thanks.

tusharmath commented 7 years ago

You can pass the auth params to the request() function — https://github.com/tusharmath/Multi-threaded-downloader#HTTP.request

pantchox commented 7 years ago

how? the master branch does README not have clear examples on how to use MTD, which makes it very unattractive to use.

tusharmath commented 7 years ago

Sorry if the README isn't clear. I'd be happy to merge a PR if you think it can be made better.

Internally mtd uses the npm's request module for making HTTP requests. So to create a new HTTP request with auth you could do something like —

const response$ = HTTP.request({
  url : 'a.b.c',
  auth: {
    'user': 'username',
    'pass': 'password',
    'sendImmediately': false
  }
}) 

Read more — https://www.npmjs.com/package/request#http-authentication

pantchox commented 7 years ago

Thanks. I mean that in the other branches (which i have no idea which one is the most update one) the README is more clear and with examples of the options.

Thanks for MTD its really good!

tusharmath commented 7 years ago

@pantchox master is the most updated branch right now. I'd be more than happy to fix the documentation.

pantchox commented 7 years ago

A simple basic usage example such as requiring the module and instantiating the class with the download options and events (start, pause, resume, finish) would make it more clear, its nice that the library looks very maintained and all the objects are being described what they do and all BUT there is NON of any examples of simple usage, digging in other branches/tags shows examples but how do i know they are aligned with this latest release. I am not trying to be annoying or having something served on a silver plate i am just saying that simple users like me need to have a concrete USAGE example. Thanks!