Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Changed style in example
  • Loading branch information
pelenium authored Dec 17, 2023
1 parent 0619f9a commit e73419e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e73419e

Please sign in to comment.