From 81f191fdcd347df0b7ae52e061c9ab39e88bdbb1 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 20 Sep 2021 11:06:47 +0200 Subject: store fileList compressed for now using zlib on a 556Mo dir: files: 1469447 o -> 207289 o size divided by 7 --- utils/ioutils.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils') 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) +} -- cgit v1.2.3