diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ioutils.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/ioutils.go b/utils/ioutils.go index a861995..fcc341e 100644 --- a/utils/ioutils.go +++ b/utils/ioutils.go @@ -17,6 +17,9 @@ type nopCloser struct { func (nopCloser) Close() error { return nil } +type ReadWrapper func(r io.Reader) (io.ReadCloser, error) +type WriteWrapper func(w io.Writer) io.WriteCloser + // ZlibReader wraps a reader with a new zlib.Reader. func ZlibReader(r io.Reader) (io.ReadCloser, error) { return zlib.NewReader(r) @@ -26,3 +29,11 @@ func ZlibReader(r io.Reader) (io.ReadCloser, error) { func ZlibWriter(w io.Writer) io.WriteCloser { return zlib.NewWriter(w) } + +func NopReadWrapper(r io.Reader) (io.ReadCloser, error) { + return io.NopCloser(r), nil +} + +func NopWriteWrapper(w io.Writer) io.WriteCloser { + return NopCloser(w) +} |