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

Function openUserFile

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

Source from the content-addressed store, hash-verified

646}
647
648func openUserFile(fn string, stdin io.ReadCloser) (io.ReadCloser, int64, error) {
649 if fn == "-" {
650 return stdin, -1, nil
651 }
652
653 r, err := os.Open(fn)
654 if err != nil {
655 return r, -1, err
656 }
657
658 s, err := os.Stat(fn)
659 if err != nil {
660 return r, -1, err
661 }
662
663 return r, s.Size(), nil
664}
665
666func parseErrorResponse(r io.Reader, statusCode int) (io.Reader, string, error) {
667 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