0) ret += flush(this[kNativeDecoder]); return ret; }; /* Everything below this line is undocumented legacy stuff. */ /** * * @param {string | Buffer | TypedArray | DataView} buf * @param {number} offset * @returns {string} */ StringDecoder.prototype.text = function text(buf, offset) { this[kNativeDecoder][kMissingBytes] = 0; this[kNativeDecoder][kBufferedBytes] = 0; return this.write(buf.slice(offset)); }; ObjectDefineProperties(StringDecoder.prototype, { lastChar: { configurable: true, enumerable: true, get() { return TypedArrayPrototypeSubarray(this[kNativeDecoder], kIncompleteCharactersStart, kIncompleteCharactersEnd); } }, lastNeed: { configurable: true, enumerable: true, get() { return this[kNativeDecoder][kMissingBytes]; } }, lastTotal: { configurable: true, enumerable: true, get() { return this[kNativeDecoder][kBufferedBytes] + this[kNativeDecoder][kMissingBytes]; } } }); exports.StringDecoder = StringDecoder;