(buffer)
| 172 | } |
| 173 | |
| 174 | read(buffer) { |
| 175 | try { |
| 176 | return fs.readSync(this.nodeStream.fd, buffer); |
| 177 | } catch (e) { |
| 178 | // Platform differences: on Windows, reading EOF throws an exception, |
| 179 | // but on other OSes, reading EOF returns 0. Uniformize behavior by |
| 180 | // catching the EOF exception and returning 0. |
| 181 | if (e.toString().includes("EOF")) { |
| 182 | return 0; |
| 183 | } |
| 184 | throw e; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | fsync() { |
| 189 | nodeFsync(this.nodeStream.fd); |