()
| 296 | } |
| 297 | |
| 298 | end() { |
| 299 | if (this.#destroyed) { |
| 300 | throw new ERR_INVALID_STATE('Utf8Stream is destroyed'); |
| 301 | } |
| 302 | |
| 303 | if (this.#opening) { |
| 304 | this.once('ready', () => { |
| 305 | this.end(); |
| 306 | }); |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | if (this.#ending) { |
| 311 | return; |
| 312 | } |
| 313 | |
| 314 | this.#ending = true; |
| 315 | |
| 316 | if (this.#writing) { |
| 317 | return; |
| 318 | } |
| 319 | |
| 320 | if (this.#len > 0 && this.#fd >= 0) { |
| 321 | this.#actualWrite(); |
| 322 | } else { |
| 323 | this.#actualClose(); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | destroy() { |
| 328 | if (this.#destroyed) { |