(chunk)
| 2 | const textDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8'); |
| 3 | |
| 4 | function bufferToString(chunk) { |
| 5 | if (typeof chunk === 'string') { |
| 6 | return chunk; |
| 7 | } |
| 8 | if (textDecoder) { |
| 9 | return textDecoder.decode(chunk); |
| 10 | } |
| 11 | return chunk.toString(); |
| 12 | } |
| 13 | |
| 14 | exports.bufferToString = bufferToString; |
no test coverage detected
searching dependent graphs…