* Reads a file synchronously. * @param {string} path The file path * @param {object|string} [options] Options or encoding * @returns {Buffer|string}
(path, options)
| 261 | * @returns {Buffer|string} |
| 262 | */ |
| 263 | readFileSync(path, options) { |
| 264 | const flag = (typeof options === 'object' && options !== null) ? |
| 265 | (options.flag ?? 'r') : 'r'; |
| 266 | const handle = this.openSync(path, flag); |
| 267 | try { |
| 268 | return handle.readFileSync(options); |
| 269 | } finally { |
| 270 | handle.closeSync(); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * Writes a file. |
no test coverage detected