aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/archive.go
blob: 01e3c7dd1f18e07a8178a512f9f30f37487c62c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package abi

import (
	"context"
	"io"

	"github.com/containers/podman/v4/pkg/domain/entities"
)

func (ic *ContainerEngine) ContainerCopyFromArchive(ctx context.Context, nameOrID, containerPath string, reader io.Reader, options entities.CopyOptions) (entities.ContainerCopyFunc, error) {
	container, err := ic.Libpod.LookupContainer(nameOrID)
	if err != nil {
		return nil, err
	}
	return container.CopyFromArchive(ctx, containerPath, options.Chown, options.Rename, reader)
}

func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID string, containerPath string, writer io.Writer) (entities.ContainerCopyFunc, error) {
	container, err := ic.Libpod.LookupContainer(nameOrID)
	if err != nil {
		return nil, err
	}
	return container.CopyToArchive(ctx, containerPath, writer)
}