(cb)
| 730 | } |
| 731 | |
| 732 | #flushBuffer(cb) { |
| 733 | validateFunction(cb, 'cb'); |
| 734 | |
| 735 | if (this.#destroyed) { |
| 736 | const error = new ERR_INVALID_STATE('Utf8Stream is destroyed'); |
| 737 | if (cb) { |
| 738 | cb(error); |
| 739 | return; |
| 740 | } |
| 741 | |
| 742 | throw error; |
| 743 | } |
| 744 | |
| 745 | if (this.#minLength <= 0) { |
| 746 | cb?.(); |
| 747 | return; |
| 748 | } |
| 749 | |
| 750 | if (cb) { |
| 751 | this.#callFlushCallbackOnDrain(cb); |
| 752 | } |
| 753 | |
| 754 | if (this.#writing) { |
| 755 | return; |
| 756 | } |
| 757 | |
| 758 | if (this.#bufs.length === 0) { |
| 759 | ArrayPrototypePush(this.#bufs, []); |
| 760 | ArrayPrototypePush(this.#lens, 0); |
| 761 | } |
| 762 | |
| 763 | this.#actualWrite(); |
| 764 | } |
| 765 | |
| 766 | #flushUtf8(cb) { |
| 767 | validateFunction(cb, 'cb'); |
no test coverage detected