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

Function openUserFile

pkg/cmd/api/api.go:633–649  ·  view source on GitHub ↗
(fn string, stdin io.ReadCloser)

Source from the content-addressed store, hash-verified

631}
632
633func openUserFile(fn string, stdin io.ReadCloser) (io.ReadCloser, int64, error) {
634 if fn == "-" {
635 return stdin, -1, nil
636 }
637
638 r, err := os.Open(fn)
639 if err != nil {
640 return r, -1, err
641 }
642
643 s, err := os.Stat(fn)
644 if err != nil {
645 return r, -1, err
646 }
647
648 return r, s.Size(), nil
649}
650
651func parseErrorResponse(r io.Reader, statusCode int) (io.Reader, string, error) {
652 bodyCopy := &bytes.Buffer{}

Callers 2

apiRunFunction · 0.85
Test_openUserFileFunction · 0.85

Calls 2

OpenMethod · 0.80
SizeMethod · 0.65

Tested by 1

Test_openUserFileFunction · 0.68