<commit_before>Simple S3 API for Go. Docs [here](http://godoc.org/github.com/eaigner/s3).

#### Acknowledgements

First, a huge thanks goes to [<NAME>](https://github.com/kr) and [Lye](https://github.com/lye) on whose s3 packages this implementation is based on for a large part. The goal of this package is simply to provide a more convenient API.

#### S3 Config

The configuration contains you credentials and bucket info.

```
s3c := &s3.S3{
  Bucket: os.Getenv("S3_BUCKET"),
  Key:    os.Getenv("S3_KEY"),
  Secret: os.Getenv("S3_SECRET"),
}
```

#### Object

`Object(path)` returns a new S3 object handle bound to the configuration it was created from.

```
obj := s3c.Object("path/to/hello.txt")
```

#### Upload

Writing to the `WriteAbortCloser` returned by `Writer()` allows you to upload objects.

```
w, err := obj.Writer()
defer w.Close()
io.Copy(w, bytes.NewBufferString("hello world!"))

// NOTE: You can abort uploads with w.Abort()
```

#### Download

Reading from the `ReadCloser` returned by `Reader()` allows you to download objects.

```
r, headers, err := obj.Reader()
b, err := ioutil.ReadAll(r)
```

#### Existence

Check if an object exists.

```
exists, err := obj.Exists()
```

#### Delete

Delete the object.

```
err := obj.Delete()
```<commit_msg>include signed url generation example<commit_after>Simple S3 API for Go. Docs [here](http://godoc.org/github.com/eaigner/s3).

#### Acknowledgements

First, a huge thanks goes to [<NAME>](https://github.com/kr) and [Lye](https://github.com/lye) on whose s3 packages this implementation is based on for a large part. The goal of this package is simply to provide a more convenient API.

#### S3 Config

The configuration contains you credentials and bucket info.

```
s3c := &s3.S3{
  Bucket: os.Getenv("S3_BUCKET"),
  Key:    os.Getenv("S3_KEY"),
  Secret: os.Getenv("S3_SECRET"),
}
```

#### Object

`Object(path)` returns a new S3 object handle bound to the configuration it was created from.

```
obj := s3c.Object("path/to/hello.txt")
```

#### Upload

Writing to the `WriteAbortCloser` returned by `Writer()` allows you to upload objects.

```
w, err := obj.Writer()
defer w.Close()
io.Copy(w, bytes.NewBufferString("hello world!"))

// NOTE: You can abort uploads with w.Abort()
```

#### Download

Reading from the `ReadCloser` returned by `Reader()` allows you to download objects.

```
r, headers, err := obj.Reader()
b, err := ioutil.ReadAll(r)
```

#### Existence

Check if an object exists.

```
exists, err := obj.Exists()
```

#### Delete

Delete the object.

```
err := obj.Delete()
```

#### Generate Signed URLs

```
o := s3c.Object("hello.txt")

p := make(s3.Policy)
p.SetExpiration(3600)
p.Conditions().AddBucket(s3c.Bucket)
p.Conditions().AddACL(s3.PublicRead)
p.Conditions().MatchStartsWith("$key", "hello.txt")

url, err := o.FormUploadURL(s3.PublicRead, p)
```

{'fraction_non_alphanumeric': 0.1695211464522894, 'fraction_numerical': 0.011534428521495981, 'mean_word_length': 4.369606003752345, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4749995', 'n_tokens_mistral': 1016, 'n_tokens_neox': 973, 'n_words': 304}