Skip to content
/ summer Public

🔥 High-performance utility for generating checksums in parallel

License

Notifications You must be signed in to change notification settings

utilyre/summer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

summer
license downloads issues version

High-performance utility for generating checksums in parallel.

Installation

  • Latest Release

  • Manual

    go install github.com/utilyre/summer/cmd/summer@latest

Usage

For starters, you can run the generate command on any file:

$ summer generate foo bar
764efa883dda1e11db47671c4a3bbd9e  foo
081ecc5e6dd6ba0d150fc4bc0e62ec50  bar

Add the -r flag to generate checksums for directories recursively:

$ summer generate -r bar nested
081ecc5e6dd6ba0d150fc4bc0e62ec50  bar
168065a0236e2e64c9c6cdd086c55f63  nested/baz

To utilize more cores of your CPU, pass --read-jobs=n and --digest-jobs=m flags, where n and m are the number of jobs used for each task respectively.

Run summer help generate to learn more about different flags.

Testing

go test -v ./...

API

It is possible to call the API of this utility directly in your own application. Here's an example:

package main

import (
	"context"
	"log"

	"github.com/utilyre/summer/pkg/summer"
)

func main() {
	results, err := summer.Sum(context.TODO(), []string{"file.txt"})
	if err != nil {
		log.Fatal(err)
	}

	for result := range results {
		if result.Err != nil {
			log.Println(result.Err)
			continue
		}

		// TODO
	}
}