(chunk, _enc, cb)
| 49 | const chunks = []; |
| 50 | const collector = new Writable({ |
| 51 | write(chunk, _enc, cb) { |
| 52 | totalLength += chunk.length; |
| 53 | if (totalLength > parsedContentLength) { |
| 54 | log.error('data stream exceed announced size', |
| 55 | { parsedContentLength, overflow: totalLength }); |
| 56 | return cb(errors.InternalError); |
| 57 | } |
| 58 | chunks.push(chunk); |
| 59 | return cb(); |
| 60 | }, |
| 61 | final(cb) { |
| 62 | settle(null, Buffer.concat(chunks).toString()); |
| 63 | cb(); |