* Copies a file. * @param {string} src Source path * @param {string} dest Destination path * @param {number} [mode] Copy mode flags * @returns {Promise }
(src, dest, mode)
| 385 | * @returns {Promise<void>} |
| 386 | */ |
| 387 | async copyFile(src, dest, mode) { |
| 388 | if (this.readonly) { |
| 389 | throw createEROFS('copyfile', dest); |
| 390 | } |
| 391 | if ((mode & COPYFILE_EXCL) !== 0) { |
| 392 | if (await this.exists(dest)) { |
| 393 | throw createEEXIST('copyfile', dest); |
| 394 | } |
| 395 | } |
| 396 | const content = await this.readFile(src); |
| 397 | await this.writeFile(dest, content); |
| 398 | } |
| 399 | |
| 400 | /** |
| 401 | * Copies a file synchronously. |
no test coverage detected