Git Product home page Git Product logo

chonker's Introduction

Chonker

Chonker

Go Reference

Download large files as parallel chunks using HTTP Range Requests in Go.

CI

Chonker works on Go 1.19, oldstable, and stable releases.

What does Chonker do?

Chonker speeds up downloads from cloud services like Amazon S3 & CloudFront. It does this in two ways.

  1. Download small pieces of a file (a.k.a a chunk) using HTTP Range requests.
  2. Download chunks in parallel.

Why?

Chonker allows CDN services to cache and serve files even if the entire file is bigger than the individual object cache limit.

It also overcomes the per-connection limit that blob storage services often have by opening connections in parallel.

The Go standard library HTTP Client downloads files as buffered streams of bytes. The Client fetches bytes into a request buffer as fast as it can, and you read bytes from the buffer as fast as you can.

Why is this a problem?

This works great when one beefy connection to an origin server can use the entire available network bandwidth between you and it. Blob file services like Amazon S3 and caching CDNs like Amazon CloudFront impose per-connection limits, but support an almost unlimited number of connections from each client.

If you are downloading a large file from S3, its almost always better to download the file in chunks, using parallel connections.

See the S3 Developer Guide and the CloudFront Developer Guide for more information on cache sizes and parallel GETs.

Use Chonker

Use chonker.Do to fetch a response for a request, or create a "chonky" http.Transport that fetches requests using HTTP Range sub-requests.

Chonker integrates well with Go download libraries. Grab and other download managers can use a http.Client with a "chonky" http.Transport. In turn, Chonker functions accept HTTP clients that could provide automatic retries or detailed logs. See Heimdall or go-retryablehttp for more.

Chonk is a Go program that uses the chonker library to download a URL into a local file. Run chonk -h for usage details.

go build -o chonk ./cmd/chonk

./chonk https://example.com

test.sh is a BASH shell script that exercises the chonk program with a list of files of varying sizes. Run test.sh -h for usage details.

License

The Chonker cat illustration is from Freepik

Chonker is available under the terms of the MIT license.

See LICENSE for the full license text.

chonker's People

Contributors

ananthb avatar

Stargazers

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

Watchers

 avatar

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.