* Appends to a file. * @param {string} path The file path * @param {Buffer|string} data The data to append * @param {object} [options] Options * @returns {Promise }
(path, data, options)
| 318 | * @returns {Promise<void>} |
| 319 | */ |
| 320 | async appendFile(path, data, options) { |
| 321 | if (this.readonly) { |
| 322 | throw createEROFS('open', path); |
| 323 | } |
| 324 | const flag = options?.flag ?? 'a'; |
| 325 | const handle = await this.open(path, flag, options?.mode); |
| 326 | try { |
| 327 | await handle.writeFile(data, options); |
| 328 | } finally { |
| 329 | await handle.close(); |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | /** |
| 334 | * Appends to a file synchronously. |
no test coverage detected