diff options
Diffstat (limited to 'node_modules/iconv-lite/encodings/internal.js')
-rw-r--r-- | node_modules/iconv-lite/encodings/internal.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js index 05ce38b27..dc1074f04 100644 --- a/node_modules/iconv-lite/encodings/internal.js +++ b/node_modules/iconv-lite/encodings/internal.js @@ -53,10 +53,20 @@ if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. function InternalDecoder(options, codec) { - StringDecoder.call(this, codec.enc); + this.decoder = new StringDecoder(codec.enc); } -InternalDecoder.prototype = StringDecoder.prototype; +InternalDecoder.prototype.write = function(buf) { + if (!Buffer.isBuffer(buf)) { + buf = Buffer.from(buf); + } + + return this.decoder.write(buf); +} + +InternalDecoder.prototype.end = function() { + return this.decoder.end(); +} //------------------------------------------------------------------------------ |