roller) => { const value = this[kHandle].decode(chunk, { stream: true }); if (value) controller.enqueue(value); }, flush: (controller) => { const value = this[kHandle].decode(); if (value) controller.enqueue(value); controller.terminate(); }, }); } /** * @readonly * @type {string} */ get encoding() { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return this[kHandle].encoding; } /** * @readonly * @type {boolean} */ get fatal() { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return this[kHandle].fatal; } /** * @readonly * @type {boolean} */ get ignoreBOM() { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return this[kHandle].ignoreBOM; } /** * @readonly * @type {ReadableStream} */ get readable() { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return this[kTransform].readable; } /** * @readonly * @type {WritableStream} */ get writable() { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return this[kTransform].writable; } [kInspect](depth, options) { if (!isTextDecoderStream(this)) throw new ERR_INVALID_THIS('TextDecoderStream'); return customInspect(depth, options, 'TextDecoderStream', { encoding: this[kHandle].encoding, fatal: this[kHandle].fatal, ignoreBOM: this[kHandle].ignoreBOM, readable: this[kTransform].readable, writable: this[kTransform].writable, }); } } ObjectDefineProperties(TextEncoderStream.prototype, { encoding: kEnumerableProperty, readable: kEnumerableProperty, writable: kEnumerableProperty, }); ObjectDefineProperties(TextDecoderStream.prototype, { encoding: kEnumerableProperty, fatal: kEnumerableProperty, ignoreBOM: kEnumerableProperty, readable: kEnumerableProperty, writable: kEnumerableProperty, }); module.exports = { TextEncoderStream, TextDecoderStream, };