(buffer: Uint8Array)
| 582 | } |
| 583 | |
| 584 | read(buffer: Uint8Array): number { |
| 585 | try { |
| 586 | return fs.readSync(this.stream.fd, buffer); |
| 587 | } catch (e) { |
| 588 | // Platform differences: on Windows, reading EOF throws an exception, |
| 589 | // but on other OSes, reading EOF returns 0. Uniformize behavior by |
| 590 | // catching the EOF exception and returning 0. |
| 591 | if ((e as Error).toString().includes("EOF")) { |
| 592 | return 0; |
| 593 | } |
| 594 | throw e; |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | fsync() { |
| 599 | nodeFsync(this.stream.fd); |
no test coverage detected