express 如何获取HTTP响应体的大小?从res._contentLength
和res.content-length
拿都不行,是需要重新res的某些方法自己计算吗?比如下面这种?
res._chunkSize = 0
const write = res.write
res.write = function (body) {
console.log('Response body before sending: ', body)
res._chunkSize += Buffer.byteLength(body)
write.call(this, body)
}