'Retrieve a file or folder from a container in the form of a tar
archive.
Args:
container (str): The container where the file is located
path (str): Path to the file or folder to retrieve
Returns:
(tuple): First element is a raw tar data stream. Second element is
a dict containing ``stat`` information on the specified ``path``.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.'

@utils.check_resource('container')
@utils.minimum_version('1.20')
def get_archive(self, container, path):

    params = {'path': path}
    url = self._url('/containers/{0}/archive', container)
    res = self._get(url, params=params, stream=True)
    self._raise_for_status(res)
    encoded_stat = res.headers.get('x-docker-container-path-stat')
    return (res.raw, (utils.decode_json_header(encoded_stat) if encoded_stat else None))
