* Write a file (creating missing directories if need be) without throwing errors. * * @param {string} filepath - The path to the file. * @param {Buffer|Uint8Array|string} contents - The data to write. * @param {Object|string} [options] - Options for writing the file. * @returns {Promi
(filepath, contents, options = {})
| 145 | * @returns {Promise<void>} |
| 146 | */ |
| 147 | async write(filepath, contents, options = {}) { |
| 148 | try { |
| 149 | await this._writeFile(filepath, contents, options) |
| 150 | } catch (err) { |
| 151 | // Hmm. Let's try mkdirp and try again. |
| 152 | await this.mkdir(dirname(filepath)) |
| 153 | await this._writeFile(filepath, contents, options) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Make a directory (or series of nested directories) without throwing an error if it already exists. |
no test coverage detected