Sign inSign up

unfor19/ops

By unfor19

Updated over 5 years ago

Image
0

1.5K

unfor19/ops repository overview

golang-parallel-download-with-accept-ranges

Download a zip file in efficient way, and unzip it.

If a URL supports the http header Accept-Ranges, it will be divided into several parts and download it concurrently.

Requirements

Build

  1. Clone
    git clone https://github.com/unfor19/golang-parallel-download-with-accept-ranges.git && \
    cd golang-parallel-download-with-accept-ranges
    
  2. Get dependencies
    go mod download
    
  3. Go Build
    go build
    # output file: ./golang-parallel-download-with-accept-ranges
    

Usage

  • Download a file with 5 connections (default: 5)
    ./golang-parallel-download-with-accept-ranges
    
  • File name with timestamp
    ./golang-parallel-download-with-accept-ranges -t
    
  • Specify the connection count
    ./golang-parallel-download-with-accept-ranges -c=7
    

Docker

  1. Clone
    git clone https://github.com/unfor19/golang-parallel-download-with-accept-ranges.git && \
    cd golang-parallel-download-with-accept-ranges
    
  2. Build
    docker build -t ops .
    
  3. Run
    docker run --rm -it ops
    

Dependencies

pb - show multiple progress bar

go get github.com/cheggaaa/pb

Older README.md leftovers

Expand/Collapse

Compile command

mac

GOOS=darwin GOARCH=amd64 go build -o download.command

windows

GOOS=windows GOARCH=amd64 go build -o download.exe

FIXME

  • File's body download on windows is different from one on mac. (e.g. mp4)

TODO

  • Support request header

Tag summary

Content type

Image

Digest

Size

13.1 MB

Last updated

over 5 years ago

docker pull unfor19/ops