MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / UploadFileWithContentType

Function UploadFileWithContentType

cli/internal/hub/util.go:74–82  ·  view source on GitHub ↗
(ctx context.Context, uploadURL, localPath, contentType string)

Source from the content-addressed store, hash-verified

72}
73
74func UploadFileWithContentType(ctx context.Context, uploadURL, localPath, contentType string) error {
75 file, err := os.Open(localPath)
76 if err != nil {
77 return fmt.Errorf("failed to open file: %w", err)
78 }
79 defer file.Close()
80
81 return UploadReaderWithContentType(ctx, uploadURL, file, contentType)
82}
83
84func UploadReaderWithContentType(ctx context.Context, uploadURL string, reader io.Reader, contentType string) error {
85 req, err := http.NewRequestWithContext(ctx, http.MethodPut, uploadURL, reader)

Callers 1

UploadFileFunction · 0.85

Calls 3

ErrorfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected