A simple, fast and interruptable download accelerator, written in Rust

Overview

build status

snatch

A simple, fast and interruptable download accelerator, written in Rust

WARNING

This project is no longer maintained by @k0pernicus and @jean-serge.
Instead of Snatch, you can use, report features or issues and/or contribute to Zou.

Snatch logo

(A special thanks to @fh-d for this awesome logo !)

Current features

  • Simple: a command line tool to manage easily your downloads ;
  • Fast: multithreading support.

NOTE: Snatch is on alpha version. This version runs well on remote contents with a length known before the download (with the content-length header from the server response) - also, the Interruptable feature is not implemented yet.

Installation

  1. Install Rust and Cargo using rustup ;
  2. You can download two versions of Snatch :
  • the latest build from crates.io: cargo install snatch ;
  • the last commit version from Github: cargo install --git https://github.com/derniercri/snatch.git --branch devel ;
  1. Enjoy !

Usage

Snatch 0.1.2
Snatch, a simple, fast and interruptable download accelerator, written in Rust.

USAGE:
    snatch [FLAGS] [OPTIONS] <url>

FLAGS:
    -d, --debug      Activate the debug mode
        --force      Assume Yes to all queries and do not prompt
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -f, --file <file>          The local file to save the remote content file
    -t, --threads <threads>    Threads which can be used to download

ARGS:
    <url>

Screenshot

example

File examples

Contributing

You want to contribute to Snatch ? Here are a few ways you can help us out :

  • improve the documentation,
  • improve the CLI,
  • add new features (please to see our issues),
  • report bugs.

If you want to create a pull request, this is the procedure to make it great:

  • create an issue to explain the problem you encountered (except for typo),
  • fork the project,
  • create a local branch to make changes (from our devel branch),
  • test your changes,
  • create a pull request (please compare it with our devel branch),
  • explain your changes,
  • submit !

Thank you for your interest in contributing to Snatch ! :-D

Changelogs

  • 0.1.3 (current)

    • Fix the behaviour to know if the download is OK or not
    • Delete automatically the file if the download is not OK
    • Fix the behaviour when downloading a file using zero thread (yes, that was possible...)
    • Fix the behaviour when downloading a file using one thread
    • Monothreading download if the remote server does not support PartialContent headers
  • 0.1.2 (2ee85c151167770ce0a71245e72c02497625087f)
    No changelogs reported

  • 0.1.1 (624a59d23e28d369bae2f9d30ea22db197f7e729)
    No changelogs reported

  • 0.1.0
    No changelogs reported

Build issues

  • Libraries cannot be build Please go check if you are using the latest version of rustc (stable), running rustup update.

  • fatal error: 'openssl/hmac.h' file not found If you are on a GNU/Linux distribution (like Ubuntu), please install libssl-dev. If you are on macOS, please install openssl and check your OpenSSL configuration:

brew install openssl
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
export DEP_OPENSSL_INCLUDE=`brew --prefix openssl`/include
Comments
  • Cannot download certain files

    Cannot download certain files

    Snatch built from devel HEAD (fac87df) cannot download these files even with -t1.

    • https://github.com/derniercri/snatch/archive/0.1.1.zip
    • https://github.com/derniercri/snatch/archive/0.1.1.tar.gz
    • https://github.com/derniercri/snatch/archive/devel.zip

    Output:

    # Waiting a response from the remote server... OK !
    # Remote content length: 384.57 KB
    Downloading 1 chunks:
    Chunk 0 ▎ |##############################################################################################################################################| 100.00 % 352.65 KB/s
    thread '<unnamed>' panicked at 'Cannot download the chunk 0, due to error Invalid Status provided', src/download.rs:167
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    Done! Your download is available in 0.1.1.zip
    
    opened by equal-l2 19
  • Can't compile snatch's pbr dependency with rustc 1.11

    Can't compile snatch's pbr dependency with rustc 1.11

    This is the output when I try to compile:

        Updating git repository `https://github.com/derniercri/snatch.git`
       Compiling ansi_term v0.9.0
       Compiling lazy_static v0.2.2
       Compiling bitflags v0.7.0
       Compiling winapi-build v0.1.1
       Compiling libc v0.2.18
       Compiling num_cpus v1.2.0
       Compiling httparse v1.2.1
       Compiling winapi v0.2.8
       Compiling gcc v0.3.40
       Compiling openssl v0.7.14
       Compiling pkg-config v0.3.8
       Compiling openssl-sys v0.7.17
       Compiling argparse v0.2.1
       Compiling rustc-serialize v0.3.22
       Compiling semver v0.1.20
       Compiling typeable v0.1.2
       Compiling openssl-sys-extras v0.7.14
       Compiling rustc_version v0.1.7
       Compiling unicase v1.4.0
       Compiling unicode-normalization v0.1.2
       Compiling language-tags v0.2.2
       Compiling traitobject v0.0.1
       Compiling kernel32-sys v0.2.2
       Compiling time v0.1.35
       Compiling pbr v1.0.0-alpha.2
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/pb.rs:436:13: 436:16 error: binary assignment operation `+=` cannot be applied to type `std::string::String` [E0368]
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/pb.rs:436             out += repeat!(" ", width - s.len());
                                                                                                ^~~
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/pb.rs:436:13: 436:16 help: run `rustc --explain E0368` to see a detailed explanation
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/multi.rs:206:17: 206:20 error: binary assignment operation `+=` cannot be applied to type `std::string::String` [E0368]
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/multi.rs:206                 out += &move_cursor_up(self.nlines);
                                                                                                       ^~~
    .cargo/registry/src/github.com-1ecc6299db9ec823/pbr-1.0.0-alpha.2/src/multi.rs:206:17: 206:20 help: run `rustc --explain E0368` to see a detailed explanation
    error: aborting due to 2 previous errors
    error: failed to compile `snatch v0.1.1 (https://github.com/derniercri/snatch.git#9e30b500)`, intermediate artifacts can be found at `/tmp/cargo-install.LV86csGNNryo`
    
    Caused by:
      Could not compile `pbr`.
    
    To learn more, run the command again with --verbose.
    

    Is there a way to pin pbr to a stable version or something like that?

    opened by knocte 5
  • Limit progress update to fix 100% cpu, larger buffer and show speed per chunk

    Limit progress update to fix 100% cpu, larger buffer and show speed per chunk

    I was trying to make a constant for the interval duration, but it does not seem possible to create a Duration in a static/const because Duration fields are private and calls are not permitted in const/static expressions.

    CPU usage is way down with the 500ms progress update interval.

    opened by lambdaupb 4
  • Error installing on OSX

    Error installing on OSX

    cargo install --git https://github.com/derniercri/snatch.git Updating git repository https://github.com/derniercri/snatch.git Updating registry https://github.com/rust-lang/crates.io-index Downloading num_cpus v1.2.0 Downloading pbr v1.0.0-alpha.2 Downloading argparse v0.2.1 Downloading hyper v0.9.14 Downloading ansi_term v0.9.0 Downloading libc v0.2.18 Downloading kernel32-sys v0.2.2 Downloading time v0.1.35 Downloading winapi v0.2.8 Downloading winapi-build v0.1.1 Downloading rustc-serialize v0.3.22 Downloading unicase v1.4.0 Downloading url v1.2.4 Downloading httparse v1.2.1 Downloading openssl-verify v0.1.0 Downloading traitobject v0.0.1 Downloading language-tags v0.2.2 Downloading solicit v0.4.4 Downloading mime v0.2.2 Downloading cookie v0.2.5 Downloading typeable v0.1.2 Downloading log v0.3.6 Downloading openssl v0.7.14 Downloading rustc_version v0.1.7 Downloading semver v0.1.20 Downloading idna v0.1.0 Downloading matches v0.1.4 Downloading unicode-normalization v0.1.2 Downloading unicode-bidi v0.2.3 Downloading bitflags v0.7.0 Downloading openssl-sys v0.7.17 Downloading lazy_static v0.2.2 Downloading openssl-sys-extras v0.7.14 Downloading pkg-config v0.3.8 Downloading gcc v0.3.40 Downloading hpack v0.2.0 Compiling unicode-normalization v0.1.2 Compiling language-tags v0.2.2 Compiling pkg-config v0.3.8 Compiling log v0.3.6 Compiling matches v0.1.4 Compiling semver v0.1.20 Compiling rustc-serialize v0.3.22 Compiling unicode-bidi v0.2.3 Compiling argparse v0.2.1 Compiling ansi_term v0.9.0 Compiling lazy_static v0.2.2 Compiling idna v0.1.0 Compiling httparse v1.2.1 Compiling rustc_version v0.1.7 Compiling unicase v1.4.0 Compiling traitobject v0.0.1 Compiling bitflags v0.7.0 Compiling mime v0.2.2 Compiling libc v0.2.18 Compiling openssl-sys v0.7.17 Compiling gcc v0.3.40 Compiling typeable v0.1.2 Compiling winapi v0.2.8 Compiling winapi-build v0.1.1 Compiling kernel32-sys v0.2.2 Compiling time v0.1.35 Compiling hpack v0.2.0 Compiling num_cpus v1.2.0 Compiling url v1.2.4 Compiling pbr v1.0.0-alpha.2 Compiling solicit v0.4.4 Compiling openssl-sys-extras v0.7.14 Build failed, waiting for other jobs to finish... error: failed to compile snatch v0.1.1 (https://github.com/derniercri/snatch.git#9e30b500), intermediate artifacts can be found at /var/folders/7c/fp0pspqj27l2frkfv567nmfh0000gn/T/cargo-install.PRrg6M7dBiun

    Caused by: failed to run custom build command for openssl-sys-extras v0.7.14 process didn't exit successfully: /var/folders/7c/fp0pspqj27l2frkfv567nmfh0000gn/T/cargo-install.PRrg6M7dBiun/release/build/openssl-sys-extras-5c7e4d8925825f00/build-script-build (exit code: 101) --- stdout TARGET = Some("x86_64-apple-darwin") OPT_LEVEL = Some("3") PROFILE = Some("release") TARGET = Some("x86_64-apple-darwin") debug=false opt-level=3 HOST = Some("x86_64-apple-darwin") TARGET = Some("x86_64-apple-darwin") TARGET = Some("x86_64-apple-darwin") HOST = Some("x86_64-apple-darwin") CC_x86_64-apple-darwin = None CC_x86_64_apple_darwin = None HOST_CC = None CC = None HOST = Some("x86_64-apple-darwin") TARGET = Some("x86_64-apple-darwin") HOST = Some("x86_64-apple-darwin") CFLAGS_x86_64-apple-darwin = None CFLAGS_x86_64_apple_darwin = None HOST_CFLAGS = None CFLAGS = None running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-o" "/var/folders/7c/fp0pspqj27l2frkfv567nmfh0000gn/T/cargo-install.PRrg6M7dBiun/release/build/openssl-sys-extras-5c7e4d8925825f00/out/src/openssl_shim.o" "-c" "src/openssl_shim.c" cargo:warning=src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found cargo:warning=#include <openssl/hmac.h> cargo:warning= ^ cargo:warning=1 error generated. ExitStatus(ExitStatus(256))

    command did not execute successfully, got: exit code: 1

    --- stderr thread 'main' panicked at 'explicit panic', .cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.40/src/lib.rs:1006 note: Run with RUST_BACKTRACE=1 for a backtrace.

    This is with the brew version of openssl already installed.

    opened by priyolahiri 3
  • Updating Hyper to v0.10

    Updating Hyper to v0.10

    Latest hyper update removed OpenSSL dependency, which will make installation easier. I've also removed the pertaining section from the readme (I haven't actually tested this on macOS, though Windows had a similar requirement)

    opened by Zengor 3
  • Default behaviour for remote contents that can not be splitted

    Default behaviour for remote contents that can not be splitted

    Snatch is a tool that download efficiently a remote content, splitting this one into chunks and download each of those in a thread.

    But, there can exists some problems if the server canno't send in a request the length of the remote content, or if the server does not use HTTP 1.1 (+). If the program meet those "problems", it stops. But, is a default behaviour for those remote contents can be to download the remote content, in a single thread?

    question 
    opened by k0pernicus 3
  • Use Indicatif

    Use Indicatif

    To try to keep snatch "simple as possible", could we maybe use https://github.com/mitsuhiko/indicatif instead of a custom "progress bar implementation" ?

    opened by xvw 2
  • Publish to crates.io

    Publish to crates.io

    https://crates.io/search?q=snatch

    If you want to grab the name snatch on crates.io.

    Also it would be easier for others to install it by:

    cargo install snatch
    
    opened by messense 2
  • incorrect file size in cli

    incorrect file size in cli

    when downloading files less than 1 mb it is displayed as 0 mb due to division truncation. snatch should either display it kilobytes or display size as floating points

    opened by ducaale 2
  • Installation documentation needs to be updated

    Installation documentation needs to be updated

    Hey there, I wanted to give snatch a try and so I followed the README to install it.

    It it suggested to do as follow : cargo install --git https://github.com/derniercri/snatch.git but once installed I noticed that it was the master version which got installed since:

    ▶ snatch -V       
    Usage:
        snatch [OPTIONS]
    snatch: Unknown short option "V"
    

    So I deleted it and reinstalled it with cargo install --git https://github.com/derniercri/snatch.git --branch devel and it solved it for me. :-)

    ▶ snatch -V
    Snatch 0.1.2
    
    opened by Outpox 2
  • Error while installing on Ubuntu 16.04

    Error while installing on Ubuntu 16.04

    I tried to install Snatch on Ubuntu 16.04, following error occurs:

    Build failed, waiting for other jobs to finish...
    error: failed to compile `snatch v0.1.1 (https://github.com/derniercri/snatch.git#f447f7ca)`, intermediate artifacts can be found at `/tmp/cargo-install.MvwyPs1F5EQJ`
    
    Caused by:
      failed to run custom build command for `openssl-sys-extras v0.7.14`
    process didn't exit successfully: `/tmp/cargo-install.MvwyPs1F5EQJ/release/build/openssl-sys-extras-5c7e4d8925825f00/build-script-build` (exit code: 101)
    --- stdout
    TARGET = Some("x86_64-unknown-linux-gnu")
    OPT_LEVEL = Some("3")
    PROFILE = Some("release")
    TARGET = Some("x86_64-unknown-linux-gnu")
    debug=false opt-level=3
    HOST = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-gnu")
    HOST = Some("x86_64-unknown-linux-gnu")
    CC_x86_64-unknown-linux-gnu = None
    CC_x86_64_unknown_linux_gnu = None
    HOST_CC = None
    CC = None
    HOST = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-gnu")
    HOST = Some("x86_64-unknown-linux-gnu")
    CFLAGS_x86_64-unknown-linux-gnu = None
    CFLAGS_x86_64_unknown_linux_gnu = None
    HOST_CFLAGS = None
    CFLAGS = None
    running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-o" "/tmp/cargo-install.MvwyPs1F5EQJ/release/build/openssl-sys-extras-5c7e4d8925825f00/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
    cargo:warning=src/openssl_shim.c:1:26: fatal error: openssl/hmac.h: No such file or directory
    cargo:warning=compilation terminated.
    ExitStatus(ExitStatus(256))
    
    
    command did not execute successfully, got: exit code: 1
    
    
    
    --- stderr
    thread 'main' panicked at 'explicit panic', .cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.40/src/lib.rs:1006
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    
    opened by mahmoudmy 2
  • hyper 0.11?

    hyper 0.11?

    Compared to 0.9, I guess hyper dropped openssl dependency and made it a pure rust library.

    I wonder when snatch will move on to hyper 0.11 and give an option to decide whether to use openssl. OpenSSL can potentially introduce security issue.

    This will give users an option to use pure Rust binary.

    opened by mssun 6
  • Alternate progress indicator like axel

    Alternate progress indicator like axel

    Hi, I like this tool! very cool!

    It would be nice if snatch could provide a alternate progress bar like the -a option in tool axel. Because I will use snatch -t40 or -t50 to download big stuff, and the screen cannot fit all that many separated progress bars :)

    Thanks!

    cli 
    opened by mitnk 1
  • Downloading files from dropbox doesn't work

    Downloading files from dropbox doesn't work

    I got a file from someone to download a file from his dropbox account.

    It's not easy to extract the exact link so I go the link that I was handed (with Firefox), click on "Download" combobox -> "Direct download" option, then I'm prompted to sign up, but I click on the small link that says "no thanks, take me to the download", and then Firefox starts downloading. Then I go to Firefox's download manager, locate the download -> right click -> Copy download link.

    Then I go to the terminal and I get this error from snatch:

    $ snatch --url https://dl.dropboxusercontent.com/content_link/onXmWanH62azyJzz85nZe7mkv8kLr8PMPX71uXtmCW15vtnwBEV6iTra4DGuqhAI/file?dl=1
    # Waiting a response from the remote server... OK !
    [ERROR] Cannot get the content length of the remote content, from the server.
    

    I've also tried to Pause or Cancel the download before I launch this command, but the result is the same (and yes, firefox allows me to pause and resume the download, and Firefox shows me the amount of bytes left, so no issue with the Content-Length header from the server I guess).

    opened by knocte 1
  • What is the optimal thread count for a 64 bit Macbook Pro?

    What is the optimal thread count for a 64 bit Macbook Pro?

    I tried to do a thread count of 4, and then a thread count of 64, and to the naked eye, for a small file, it seemed indistinguishable. What is the optimal thread count?

    opened by MeetThePatel 2
  • Better CLI

    Better CLI

    I love snatch but I have few notes regarding CLI.

    • Remove -u, why not just snatch http://example.com/bigfile.mp4 ?
    • Optional -f, why not deduce filename from URL?
    • Support for multiple URLs, something like snatch http://example.com/a.mp4 http://example.com/b.mp4
    enhancement cli 
    opened by korczis 1
Releases(0.1.1)
Owner
Dernier Cri ®
We craft beautiful products for startups
Dernier Cri ®
Multi-protocol CLI download accelerator

dlrs dlrs is a multi-protocol download tool for the command line. Written in Rust, dlrs splits your downloads to speed them up where possible. Feature

Tushar 7 Aug 7, 2023
A simple CLI to build VEXCode V5 Pro projects and download them to the V5 brain.

vexer A simple CLI to build VEXCode V5 Pro projects and download them to the V5 brain. (WIP) This currently is only tested on and only works on window

null 2 May 16, 2022
dlfile is a very simple, straightforward CLI to download a file

dlfile dlfile is a very simple, straightforward CLI to download a file, except it... Only downloads over HTTPS Requires TLS 1.2 or higher Executes in

Colin 3 Oct 21, 2022
CLI tool and crate to download FTDC data from mongodb clusters.

Download mongodb FTDC data Command line tool and lib crate to download FTDC data from mongodb clusters to investigate with e.g. keyhole. Crate For the

Mathias Oertel 0 Nov 7, 2021
Download pdbs from symbol servers and cache locally, parse symbol paths from env vars

symsrv This crate lets you download and cache pdb files from symbol servers, according to the rules from the _NT_SYMBOL_PATH environment variable. It

Markus Stange 6 Sep 15, 2022
A cli tool to automatically download and upload advent of code problems.

Advent of Code CLI CLI client for advent of code. The purpose of this tool is so you don't have to leave your editor while participating (if you are l

Tobias Walle 43 Dec 7, 2023
Media player with Youtube search, download, and playback functionality.

Pomelo 0.2.0 Pomelo is a desktop media player with Youtube search, playback, and download functionality. Current features Play videos locally from the

null 3 Sep 29, 2024
Download binary for your OS from Github

github-bin-downloader Download binary for your OS from Github. Installation Install github-bin-downloader using cargo cargo install github-bin-downloa

353fc443 10 Dec 11, 2022
A cli tool to download specific GitHub directories or files

cloneit A cli tool to download specific GitHub directories or files. Installation From git git clone https://github.com/alok8bb/cloneit cd cloneit car

Alok 54 Dec 20, 2022
Cross-platform terminal program to download IEEE journals

IEEE Journal Downloader A cross-platform terminal program which tries to download every article in a specified journal and merge the documents into on

Fong Chien Yoong 18 Jul 23, 2022
Nazuna - 🐦 Download Twitter videos using your terminal!

Nazuna ?? Download Twitter videos using your terminal! Installation Binary Download the desired file for your OS (Windows, Mac, Linux) from https://gi

Felipe Garcia 27 Nov 22, 2022
Use the osu!direct button on the osu! website to download beatmaps directly to osu

osum!direct-web Use the osu!direct button on the osu! website to download beatmaps directly to osu! - without osu! supporter. Badges Usage Run the app

oSumAtrIX 1 Jan 21, 2022
cli application to visualize crate download metrics.

cli application to visualize crate download metrics.

Orhan Balci 2 Dec 13, 2022
A cli tool to download Imperial DoC past papers 🦀

Exams DoC Downloader A cli tool to download past papers from exams.doc.ic.ac.uk. An excercise in procrastination, written in Rust ?? . This currently

Ashvin Arsakularatne 3 Apr 8, 2022
Download your Stripe account to a SQLite database.

tdog tdog is a CLI to download your Stripe account to a SQLite database. table.dog Sponsor development Install # macOS: curl -L --output /usr/local/bi

Table Dog 16 Oct 10, 2022
🧰 Download pre-built binaries of all your favourite tools with a single command

tool-sync tool-sync is a CLI tool that solves one problem: ?? Download pre-built binaries of all your favourite tools with a single command. tool-sync

Dmitrii Kovanikov 50 Jan 1, 2023
Periodically download a youtube playlist, extract audio, convert to mp3, move to directory (possibly synced using syncthing).

auto-dl Periodically download a youtube playlist, extract audio, convert to mp3, move to directory (possibly synced using syncthing). drop https://git

Paul Adenot 10 Jan 12, 2023
A commandline tool to download video from bilibili.

Bilibili-dl 不断学习,持续更新中.... A commandline program to download video from bilibili. How to use bilibili-dl -h print help bilibili-dl download <URL> to

Jason 4 Oct 9, 2023
TTAutoRecord is a tool to automatically download TikTok Livestreams of users you follow.

TTAutoRecord: Automated TikTok Live Stream Recorder TTAutoRecord is a specialized utility designed to automate the recording of live streams on TikTok

Ollie 4 Oct 30, 2023