Skip to content

proposal: io: add ReadPeeker and implement Peek in bytes.Reader #63548

@mhr3

Description

@mhr3

Is there any reason why bytes.Reader doesn't have a Bytes() or Next(int) method similar to bytes.Buffer?

Such a method would allow zero-copy usage of bytes.Reader, cause currently all public methods require a separate buffer to copy the data into. Plus these methods already exist on bytes.Buffer, so gophers are already familiar with them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions