func CopyFileWithTar(src, dst string) (err error) {
	return chrootArchiver.CopyFileWithTar(src, dst)
}
CopyFileWithTar emulates the behavior of the 'cp' command-line
for a single file. It copies a regular file from path `src` to
path `dst`, and preserves all its metadata.

If `dst` ends with a trailing slash '/' ('\' on Windows), the final
destination path will be `dst/base(src)` or `dst\base(src)`
package chrootarchive
import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"github.com/docker/docker/pkg/archive"
	"github.com/docker/docker/pkg/idtools"
)
var chrootArchiver = &archive.Archiver{Untar: Untar}
func Untar(tarArchive io.Reader, dest string, options *archive.TarOptions) error {
	return untarHandler(tarArchive, dest, options, true)
}
func UntarUncompressed(tarArchive io.Reader, dest string, options *archive.TarOptions) error {
	return untarHandler(tarArchive, dest, options, false)
}
func untarHandler(tarArchive io.Reader, dest string, options *archive.TarOptions, decompress bool) error {
	if tarArchive == nil {
		return fmt.Errorf("Empty archive")
	}
	if options == nil {
		options = &archive.TarOptions{}
	}
	if options.ExcludePatterns == nil {
		options.ExcludePatterns = []string{}
	}
	rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
	if err != nil {
		return err
	}
	dest = filepath.Clean(dest)
	if _, err := os.Stat(dest); os.IsNotExist(err) {
		if err := idtools.MkdirAllNewAs(dest, 0755, rootUID, rootGID); err != nil {
			return err
		}
	}
	r := ioutil.NopCloser(tarArchive)
	if decompress {
		decompressedArchive, err := archive.DecompressStream(tarArchive)
		if err != nil {
			return err
		}
		defer decompressedArchive.Close()
		r = decompressedArchive
	}
	return invokeUnpack(r, dest, options)
}
func TarUntar(src, dst string) error {
	return chrootArchiver.TarUntar(src, dst)
}
func CopyWithTar(src, dst string) error {
	return chrootArchiver.CopyWithTar(src, dst)
}