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

Function openUserFile

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

Source from the content-addressed store, hash-verified

635}
636
637func openUserFile(fn string, stdin io.ReadCloser) (io.ReadCloser, int64, error) {
638 if fn == "-" {
639 return stdin, -1, nil
640 }
641
642 r, err := os.Open(fn)
643 if err != nil {
644 return r, -1, err
645 }
646
647 s, err := os.Stat(fn)
648 if err != nil {
649 return r, -1, err
650 }
651
652 return r, s.Size(), nil
653}
654
655func parseErrorResponse(r io.Reader, statusCode int) (io.Reader, string, error) {
656 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