browser-buffer-decode.js 449 B

123456789101112131415
  1. "use strict";
  2. // eslint-disable-next-line node/no-unsupported-features/node-builtins
  3. const textDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8');
  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. exports.bufferToString = bufferToString;
  14. //# sourceMappingURL=browser-buffer-decode.js.map