-
-
Notifications
You must be signed in to change notification settings - Fork 590
Closed
Labels
Description
The filters usually return a *bytes.Buffer, so copying it into a temporary bytes.Buffer to get the underlying []byte can be avoided.
Example:
pdfcpu/pkg/pdfcpu/types/streamdict.go
Lines 292 to 297 in fc87a22
| var buf bytes.Buffer | |
| if _, err := io.Copy(&buf, c); err != nil { | |
| return err | |
| } | |
| sd.Content = buf.Bytes() |
Same applies for the filters itself which can be chained and in such casees also don't need to copy from the passed io.Reader if it is actually a *bytes.Buffer.