* Reads the entire file. * @param {object|string} [options] Options or encoding * @returns {Promise }
(options)
| 588 | * @returns {Promise<Buffer|string>} |
| 589 | */ |
| 590 | async readFile(options) { |
| 591 | this.#checkClosed('read'); |
| 592 | this.#checkReadable(); |
| 593 | |
| 594 | // Get content asynchronously (supports async content providers) |
| 595 | const content = await this.getContentAsync(); |
| 596 | const encoding = typeof options === 'string' ? options : options?.encoding; |
| 597 | if (encoding) { |
| 598 | return content.toString(encoding); |
| 599 | } |
| 600 | return Buffer.from(content); |
| 601 | } |
| 602 | |
| 603 | /** |
| 604 | * Writes data to the file synchronously. |
nothing calls this directly
no test coverage detected