MCPcopy Create free account
hub / github.com/cli/cli / NewFrameReader

Function NewFrameReader

internal/eventstream/sse.go:44–49  ·  view source on GitHub ↗

NewFrameReader returns a FrameReader that reads from r.

(r io.Reader)

Source from the content-addressed store, hash-verified

42
43// NewFrameReader returns a FrameReader that reads from r.
44func NewFrameReader(r io.Reader) *FrameReader {
45 scanner := bufio.NewScanner(r)
46 scanner.Buffer(make([]byte, 0, 4096), maxLineSize)
47 scanner.Split(newLineSplitter())
48 return &FrameReader{scanner: scanner}
49}
50
51// Next blocks until a complete frame is read and returns it. It returns io.EOF when the stream ends; a frame that
52// is not terminated by a blank line before the end is discarded.

Callers 5

readEventsMethod · 0.92
TestFrameReaderFunction · 0.85
TestFrameReaderReadErrorFunction · 0.85

Calls 1

newLineSplitterFunction · 0.85

Tested by 4

TestFrameReaderFunction · 0.68
TestFrameReaderReadErrorFunction · 0.68