(cb)
| 764 | } |
| 765 | |
| 766 | #flushUtf8(cb) { |
| 767 | validateFunction(cb, 'cb'); |
| 768 | |
| 769 | if (this.#destroyed) { |
| 770 | const error = new ERR_INVALID_STATE('Utf8Stream is destroyed'); |
| 771 | if (cb) { |
| 772 | cb(error); |
| 773 | return; |
| 774 | } |
| 775 | |
| 776 | throw error; |
| 777 | } |
| 778 | |
| 779 | if (this.#minLength <= 0) { |
| 780 | cb?.(); |
| 781 | return; |
| 782 | } |
| 783 | |
| 784 | if (cb) { |
| 785 | this.#callFlushCallbackOnDrain(cb); |
| 786 | } |
| 787 | |
| 788 | if (this.#writing) { |
| 789 | return; |
| 790 | } |
| 791 | |
| 792 | if (this.#bufs.length === 0) { |
| 793 | ArrayPrototypePush(this.#bufs, ''); |
| 794 | } |
| 795 | |
| 796 | this.#actualWrite(); |
| 797 | } |
| 798 | |
| 799 | #writeBuffer(data) { |
| 800 | if (this.#destroyed) { |
no test coverage detected