hunger / downloader Goto Github PK
View Code? Open in Web Editor NEWSimple HTTP/HTTPS file downloader crate.
Simple HTTP/HTTPS file downloader crate.
tonight my beta tester of my game which tests the downloader reported that when he went to another room and lost the wifi connection so his downloading got stuck and did not resume and then when I tried it via windows command line so I started downloading disconnected the ethernet cable and the command line got stuck
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.
All of the common digest algorithms including sha3_256
implement the digest::Digest
trait, so the digest verification function can be made generic with respect to that, and be used for any digest algorithm rather than a pre-defined one.
I'm getting this error even though I'm not enabling verification:
Error: Download failed for file.mp3: (verification: unverified)
What am I supposed to do?
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"] }
hello please add a feature that allows me to download 1 or more files at a higher speed
Would it be difficult to add support for downloads from S3, Google cloud storage and possibly others?
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
net2
crate has been deprecated; usesocket2
instead
Details | |
---|---|
Status | unmaintained |
Package | net2 |
Version | 0.2.37 |
URL | deprecrated/net2-rs@3350e38 |
Date | 2020-05-01 |
The net2
crate has been deprecated
and users are encouraged to considered socket2
instead.
See advisory page for additional details.
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.
It might also make sense to support those features directly and I can file separate issues for those if you agree.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.