Created
January 3, 2016 17:21
-
-
Save fd0/f852268fe0862fca81b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
crand "crypto/rand" | |
"github.com/minio/minio-go" | |
) | |
const bucket = "restic-test-ffm" | |
const path = "testfile" | |
func main() { | |
client, err := minio.New("s3.amazonaws.com", os.Getenv("AWS_ACCESS_KEY_ID"), os.Getenv("AWS_SECRET_ACCESS_KEY"), false) | |
if err != nil { | |
log.Fatal(err) | |
} | |
client.TraceOn(os.Stderr) | |
// generate data | |
buf := bytes.NewBuffer(nil) | |
io.CopyN(buf, crand.Reader, 1<<23) | |
// save the data | |
n, err := client.PutObject(bucket, path, buf, int64(buf.Len()), "binary/octet-stream") | |
fmt.Printf("n %v, err %#v\n",n, err) | |
if err != nil { | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment