diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-20 11:06:47 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-20 11:44:32 +0200 |
commit | 81f191fdcd347df0b7ae52e061c9ab39e88bdbb1 (patch) | |
tree | 489fff15739ba095f75223b460bec48d034c06a6 /utils | |
parent | 129032a13d19d500011fe23bcdd232b87eeb9b2f (diff) | |
download | dna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.tar.gz dna-backup-81f191fdcd347df0b7ae52e061c9ab39e88bdbb1.zip |
store fileList compressed
for now using zlib on a 556Mo dir:
files: 1469447 o -> 207289 o
size divided by 7
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) +} |