* Recursively removes a directory and all of its contents. This is equivalent * to rm -rf on a POSIX system. * @param {string} dirPath Path to the directory to remove. * @return {!Promise} A promise to be resolved when the operation has * completed.
(dirPath)
| 50 | * completed. |
| 51 | */ |
| 52 | function rmDir(dirPath) { |
| 53 | return new Promise(function (fulfill, reject) { |
| 54 | fs.rm(dirPath, { recursive: true, maxRetries: 2 }, function (err) { |
| 55 | if (err && err.code === 'ENOENT') { |
| 56 | fulfill() |
| 57 | } else if (err) { |
| 58 | reject(err) |
| 59 | } |
| 60 | fulfill() |
| 61 | }) |
| 62 | }) |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Copies one file to another. |