From e73419e8ae94330abc3d1e5b5500d9590c24f05f Mon Sep 17 00:00:00 2001 From: Ilya Chernyshov <100530752+pelenium@users.noreply.github.com> Date: Sun, 17 Dec 2023 21:51:19 +0300 Subject: [PATCH] Update README.md Changed style in example --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 25f33b3b88..bf8a92aee7 100644 --- a/README.md +++ b/README.md @@ -566,18 +566,18 @@ For direct deflate use, NewStatelessWriter and StatelessDeflate are available. S A `bufio.Writer` can of course be used to control write sizes. For example, to use a 4KB buffer: -``` - // replace 'ioutil.Discard' with your output. - gzw, err := gzip.NewWriterLevel(ioutil.Discard, gzip.StatelessCompression) - if err != nil { - return err - } - defer gzw.Close() - - w := bufio.NewWriterSize(gzw, 4096) - defer w.Flush() - - // Write to 'w' +```go +// replace 'ioutil.Discard' with your output. +gzw, err := gzip.NewWriterLevel(ioutil.Discard, gzip.StatelessCompression) +if err != nil { + return err +} +defer gzw.Close() + +w := bufio.NewWriterSize(gzw, 4096) +defer w.Flush() + +// Write to 'w' ``` This will only use up to 4KB in memory when the writer is idle.