MCPcopy Index your code
hub / github.com/devspace-sh/devspace / downloadFromPod

Function downloadFromPod

pkg/devspace/hook/download.go:83–97  ·  view source on GitHub ↗
(ctx context.Context, client kubectl.Client, pod *k8sv1.Pod, container, containerPath string, writer io.Writer)

Source from the content-addressed store, hash-verified

81}
82
83func downloadFromPod(ctx context.Context, client kubectl.Client, pod *k8sv1.Pod, container, containerPath string, writer io.Writer) error {
84 stderr := &bytes.Buffer{}
85 err := client.ExecStream(ctx, &kubectl.ExecStreamOptions{
86 Pod: pod,
87 Container: container,
88 Command: []string{"tar", "czf", "-", containerPath},
89 Stdout: writer,
90 Stderr: stderr,
91 })
92 if err != nil {
93 return errors.Errorf("error executing tar: %s: %v", stderr.String(), err)
94 }
95
96 return nil
97}
98
99func getPrefix(file string) string {
100 // tar strips the leading '/' if it's there, so we will too

Callers 1

downloadFunction · 0.85

Calls 3

StringMethod · 0.95
ExecStreamMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected