mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Merge pull request #31 from fkautz/pr_out_adding_minio_encode_binary
Adding minio-encode binary
This commit is contained in:
commit
6fa2ad2444
1
Makefile
1
Makefile
@ -10,6 +10,7 @@ test: build-erasure
|
|||||||
godep go test -race -coverprofile=cover.out github.com/minio-io/minio
|
godep go test -race -coverprofile=cover.out github.com/minio-io/minio
|
||||||
|
|
||||||
install: build-erasure
|
install: build-erasure
|
||||||
|
godep go install github.com/minio-io/minio/cmd/minio-encode
|
||||||
|
|
||||||
save:
|
save:
|
||||||
godep save ./...
|
godep save ./...
|
||||||
|
31
cmd/minio-encode/main.go
Normal file
31
cmd/minio-encode/main.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
"github.com/minio-io/minio/erasure"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := cli.NewApp()
|
||||||
|
app.Name = "minio-encode"
|
||||||
|
app.Usage = "erasure encode a byte stream"
|
||||||
|
app.Action = func(c *cli.Context) {
|
||||||
|
erasureParameters, _ := erasure.ValidateParams(10, 5, 8, erasure.VANDERMONDE)
|
||||||
|
|
||||||
|
encoder := erasure.NewEncoder(erasureParameters)
|
||||||
|
input, err := ioutil.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Error reading stdin")
|
||||||
|
}
|
||||||
|
encodedData, _ := encoder.Encode(input)
|
||||||
|
for key, data := range encodedData {
|
||||||
|
ioutil.WriteFile("output."+strconv.Itoa(key), data, 0600)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app.Run(os.Args)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user