Skip to content

Avoid unnecessary copying with filters. #810

@fancycode

Description

@fancycode

The filters usually return a *bytes.Buffer, so copying it into a temporary bytes.Buffer to get the underlying []byte can be avoided.

Example:

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions