@access.cookie
    @access.public
    @loadmodel(model='file', level=AccessType.READ)
    @describeRoute(
        Description('Download a file.')
        .notes('This endpoint also accepts the HTTP "Range" header for partial '
               'file downloads.')
        .param('id', 'The ID of the file.', paramType='path')
        .param('offset', 'Start downloading at this offset in bytes within '
               'the file.', dataType='integer', required=False)
        .param('endByte', 'If you only wish to download part of the file, '
               'pass this as the index of the last byte to download. Unlike '
               'the HTTP Range header, the endByte parameter is non-inclusive, '
               'so you should set it to the index of the byte one past the '
               'final byte you wish to receive.', dataType='integer',
               required=False)
        .param('contentDisposition', 'Specify the Content-Disposition response '
               'header disposition-type value', required=False,
               enum=['inline', 'attachment'], default='attachment')
        .errorResponse('ID was invalid.')
        .errorResponse('Read access was denied on the parent folder.', 403)
    )
    def download(self, file, params):
        rangeHeader = cherrypy.lib.httputil.get_ranges(
            cherrypy.request.headers.get('Range'), file.get('size', 0))

        # The HTTP Range header takes precedence over query params
        if rangeHeader and len(rangeHeader):
            # Currently we only support a single range.
            offset, endByte = rangeHeader[0]
        else:
            offset = int(params.get('offset', 0))
            endByte = params.get('endByte')

            if endByte is not None:
                endByte = int(endByte)

        contentDisp = params.get('contentDisposition', None)
        if (contentDisp is not None and
           contentDisp not in {'inline', 'attachment'}):
            raise RestException('Unallowed contentDisposition type "%s".' %
                                contentDisp)

        return self.model('file').download(file, offset, endByte=endByte,
                                           contentDisposition=contentDisp)
Defers to the underlying assetstore adapter to stream a file out.
dataset/ETHPy150Open girder/girder/girder/api/v1/file.py/File.download