Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sioutil package #8

Merged
merged 1 commit into from
May 28, 2019
Merged

add sioutil package #8

merged 1 commit into from
May 28, 2019

Conversation

aead
Copy link
Member

@aead aead commented May 28, 2019

What does the PR do?

This PR introduces the sioutil package.
It contains just a NopCloser method that is
related to https://golang.org/pkg/io/ioutil/#NopCloser.

It wraps a io.Writer and returns a io.WriteCloser that
does nothing on Close().
This is useful when en/decrypting an io.Writer but completing
the en/decryption process should not close the sink.

For example:

ew := s.EncryptWriter(sioutil.NopCloser(w), nonce, associatedData)
defer ew.Close() // This does not close 'w'.

What problem does it solve?

updates #7

This commit introduces the `sioutil` package.
It contains just a `NopCloser` method that is
related to https://golang.org/pkg/io/ioutil/#NopCloser.

It wraps a io.Writer and returns a io.WriteCloser that
does nothing on Close().
This is useful when en/decrypting an io.Writer but completing
the en/decryption process should not close the sink.

For example:
```
ew := s.EncryptWriter(sioutil.NopCloser(w), nonce, associatedData)
defer ew.Close() // This does not close 'w'.
```

updates #7
@aead aead merged commit 2689a43 into master May 28, 2019
@aead aead deleted the sioutil branch May 28, 2019 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant