Skip to content

unblee/cccp

Repository files navigation

cccp

Build Status GoDoc MIT License

Description

A library that provides a concurrent copy function with progress bars.

See godoc for complete documentation.

Screenshot

Screenshot 01

Screenshot 02

Usage

package main

import (
	"context"
	"log"
	"path"

	"github.com/unblee/cccp"
)

func main() {
	urls := []string{
		"https://dl.google.com/go/go1.11.linux-amd64.tar.gz",
		"https://dl.google.com/go/go1.11.windows-amd64.msi",
		"https://dl.google.com/go/go1.11.darwin-amd64.pkg",
	}

	for _, url := range urls {
		err := cccp.SetFromURLToFile(url, path.Base(url), "")
		if err != nil {
			log.Fatalln(err)
		}
	}

	cccp.SetOptions(cccp.WithConcurrentNumCPU())
	// cccp.SetOptions(cccp.WithConcurrent(1), cccp.WithEnableSequentialProgressbars())
	err := cccp.Run(context.Background())
	if err != nil {
		log.Fatalln(err)
	}
}

Installation

$ go get github.com/unblee/cccp

TODO

  • Add tests

Contribution

  1. Fork(https://github.com/unblee/cccp/fork)
  2. Create a branch (git checkout -b my-fix)
  3. Commit your changes (git commit -am "fix something")
  4. Push to the branch (git push origin my-fix)
  5. Create a new Pull Request
  6. Have a coffee break and wait

Author

unblee

License

license