def downloadFile(self, file, offset=0, headers=True, endByte=None,
                     contentDisposition=None, **kwargs):
        """
        When downloading a single file with HTTP, we redirect to S3. Otherwise,
        e.g. when downloading as part of a zip stream, we connect to S3 and
        pipe the bytes from S3 through the server to the user agent.
        """
        if self.assetstore.get('botoConnect', {}).get('anon') is True:
            urlFn = self._anonDownloadUrl
        else:
            urlFn = self._botoGenerateUrl

        if headers:
            if file['size'] > 0:
                queryParams = {}
                if contentDisposition == 'inline':
                    # Tell S3 to set Content-Disposition response header,
                    # though AWS only will set the response header for
                    # non-anonymous connections.
                    # Girder sets the Content-Disposition for files uploaded
                    # to S3 to be 'attachment; filename="{}"' by default.
                    queryParams['response-content-disposition'] = \
                        'inline; filename="%s"' % file['name']
                url = urlFn(key=file['s3Key'], queryParams=queryParams)
                raise cherrypy.HTTPRedirect(url)
            else:
                self.setContentHeaders(file, 0, 0)

                def stream():
                    yield ''
                return stream
        else:
            def stream():
                if file['size'] > 0:
                    pipe = requests.get(urlFn(key=file['s3Key']), stream=True)
                    for chunk in pipe.iter_content(chunk_size=BUF_LEN):
                        if chunk:
                            yield chunk
                else:
                    yield ''
            return stream
dataset/ETHPy150Open girder/girder/girder/utility/s3_assetstore_adapter.py/S3AssetstoreAdapter.downloadFile/original