diff --git a/lib/string_decoder.js b/lib/string_decoder.js index 3d2cc2fcb6ab51..2891e0a1d1a43a 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -25,6 +25,7 @@ const { ArrayBufferIsView, ObjectDefineProperties, Symbol, + TypedArrayPrototypeSubarray, } = primordials; const { Buffer } = require('buffer'); @@ -104,8 +105,9 @@ ObjectDefineProperties(StringDecoder.prototype, { configurable: true, enumerable: true, get() { - return this[kNativeDecoder].subarray(kIncompleteCharactersStart, - kIncompleteCharactersEnd); + return TypedArrayPrototypeSubarray(this[kNativeDecoder], + kIncompleteCharactersStart, + kIncompleteCharactersEnd); } }, lastNeed: {