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

Function openUserFile

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

Source from the content-addressed store, hash-verified

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