Skip to content

Commit 083d642

Browse files
committed
1 parent e00db02 commit 083d642

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/unpack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ module.exports = function (input, isSprite, callback) {
4040

4141
// If not legacy or zip, convert buffer to UTF-8 string and return
4242
if (!isZip && !isLegacy) {
43-
return callback(null, [input.toString('utf-8'), null]);
43+
// In browsers, the native TextDecoder can handle much larger values than the JavaScript polyfill for
44+
// Buffer.toString('utf-8'), particularly in Chrome.
45+
const decoder = new TextDecoder();
46+
return callback(null, [decoder.decode(input), null]);
4447
}
4548

4649
// Return error if legacy encoding detected

0 commit comments

Comments
 (0)