function respondWithData(request, response, log, bucket, data, lastModified) {
    const dataBuffer = Buffer.from(data);
    const responseMetaHeaders = getResponseHeader(request, bucket, dataBuffer, lastModified, log);

    response.on('finish', () => {
        let contentLength = 0;
        if (responseMetaHeaders && responseMetaHeaders['Content-Length']) {
            contentLength = responseMetaHeaders['Content-Length'];
        }
        log.end().addDefaultFields({ contentLength });
        log.end().info('responded with streamed content', {
            httpCode: response.statusCode,
        });
    });

    if (responseMetaHeaders && typeof responseMetaHeaders === 'object') {
        Object.keys(responseMetaHeaders).forEach(key => {
            if (responseMetaHeaders[key] !== undefined) {
                try {
                    response.setHeader(key, responseMetaHeaders[key]);
                } catch (e) {
                    log.debug('header can not be added ' +
                        'to the response', {
                        header: responseMetaHeaders[key],
                        error: e.stack, method: 'routeVeeam/respondWithData'
                    });
                }
            }
        });
    }

    response.writeHead(200);
    const stream = Readable.from(dataBuffer);
    stream.pipe(response);
    stream.on('unpipe', () => {
        response.end();
    });
    stream.on('error', () => {
        response.end();
    });
}
Generic function to respond to user with data using streams

@param {object} request - incoming request
@param {object} response - response object
@param {object} log - logging object
@param {BucketInfo} bucket - bucket info
@param {string} data - data to send
@param {date} [lastModified] - last modified date of the value
@returns {undefined} -