/bep53-range

bep53-range library written in go

Primary LanguageGoMIT LicenseMIT

bep53-range is a library for parsing bep53 ranges.

Go Reference x codecov Go Report Card


Installation

go get github.com/go-bittorrent/bep53-range

Example

package main

import (
	"fmt"

	"github.com/go-bittorrent/bep53-range/bep53"
)

func main() {
	parsed, err := bep53.Parse([]string{"1-5", "2", "6-12"})
	if err != nil {
		panic(err)
	}

	fmt.Println(parsed)                // [1 2 3 4 5 2 6 7 8 9 10 11 12]
	fmt.Println(bep53.Compose(parsed)) // [1-5 2 6-12]
}

License

MIT