Giter VIP home page Giter VIP logo

downloader's People

Contributors

alez-dev avatar dralley avatar hunger avatar pre-commit-ci[bot] avatar vivyir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

downloader's Issues

ability to get size of files for downloading

hello another feature I would like to ask you is the ability to see the file size of the file that is currently being downloaded so that I can show it to the players who are downloading files in my game

Support S3 and others

Problem

Would it be difficult to add support for downloads from S3, Google cloud storage and possibly others?

Support building a Downloader using a provided (and pre-configured) reqwest::Client

A user might want to use reqwest::Client features which this library doesn't have support for configuring - one easy and generic way around that would be to allow building a downloader with a provided request::Client, skipping the normal configuration steps in that case.

e.g.

  • proxy configuration
  • tls client cert configuration
  • custom CA bundles

It might also make sense to support those features directly and I can file separate issues for those if you agree.

Non-async client backend feature?

First of all, this crate is great, and the code is very clean, so thank you.

It would be nice to have the option to use simple blocking io instead of pulling in tokio and reqwest which are rather heavy dependencies. For a client that is only expected to have a small number of active connections (probably less than 50), there isn't really going to be much difference between blocking io + threads and asynchronous io.

Would you be open to this?

Panic when used in async application

I have a small async application which needs to download a bunch of files, therefore I decided to use this library to re-implement the downloading part.

It worked fairly well, except that at the end of the downloads it fails with the following message:

The application panicked (crashed).
Message:  Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.

This line https://github.com/hunger/downloader/blob/0.2.6/src/backend.rs#L168 seems to be the culprit, but I am not entirely sure how to workaround it.

I am using the following dependencies for downloader and tokio:

downloader = { version = "0.2.6", features = ["tui", "verify"]}
tokio = { version = "1.12.0", features = ["full"] }

cargo test should include all features

When running the tests with cargo test --all-features, we can see that they fail due to a lifetime issue:

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:124:34
    |
117 |         fn setup(&self, max_progress: Option<u64>, message: &str) {
    |                                                             ---- this data with an anonymous lifetime `'_`...
...
124 |                 lock.set_message(message);
    |                                  ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:124:22
    |
124 |                 lock.set_message(message);
    |                      ^^^^^^^^^^^

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:142:34
    |
117 |         fn setup(&self, max_progress: Option<u64>, message: &str) {
    |                                                             ---- this data with an anonymous lifetime `'_`...
...
142 |                 lock.set_message(message)
    |                                  ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:142:22
    |
142 |                 lock.set_message(message)
    |                      ^^^^^^^^^^^

error[E0759]: `message` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
   --> src/progress.rs:153:30
    |
151 |         fn set_message(&self, message: &str) {
    |                                        ---- this data with an anonymous lifetime `'_`...
152 |             let lock = self.progress_bar.lock().unwrap();
153 |             lock.set_message(message);
    |                              ^^^^^^^ ...is used here...
    |
note: ...and is required to live as long as `'static` here
   --> src/progress.rs:153:18
    |
153 |             lock.set_message(message);
    |                  ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0759`.
error: could not compile `downloader` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

This error was not caught by the CI because not all the features where tested by cargo test.

Also, running the TUI example cargo run --example tui_basic --features tui fails with the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.