(tool)
| 20004 | * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. |
| 20005 | * |
| 20006 | * @param {SummaryWriteOptions} [options] (optional) options for write operation |
| 20007 | * |
| 20008 | * @returns {Promise<Summary>} summary instance |
| 20009 | */ |
| 20010 | write(options) { |
| 20011 | return __awaiter(this, void 0, void 0, function* () { |
| 20012 | const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); |
| 20013 | const filePath = yield this.filePath(); |
| 20014 | const writeFunc = overwrite ? writeFile : appendFile; |
| 20015 | yield writeFunc(filePath, this._buffer, { encoding: "utf8" }); |
| 20016 | return this.emptyBuffer(); |
| 20017 | }); |
| 20018 | } |
| 20019 | /** |
| 20020 | * Clears the summary buffer and wipes the summary file |
| 20021 | * |
| 20022 | * @returns {Summary} summary instance |
| 20023 | */ |
| 20024 | clear() { |
| 20025 | return __awaiter(this, void 0, void 0, function* () { |
| 20026 | return this.emptyBuffer().write({ overwrite: true }); |
| 20027 | }); |
| 20028 | } |
| 20029 | /** |
| 20030 | * Returns the current summary buffer as a string |
| 20031 | * |
| 20032 | * @returns {string} string of summary buffer |
| 20033 | */ |
| 20034 | stringify() { |
| 20035 | return this._buffer; |
| 20036 | } |
| 20037 | /** |
| 20038 | * If the summary buffer is empty |
| 20039 | * |
| 20040 | * @returns {boolen} true if the buffer is empty |
| 20041 | */ |
| 20042 | isEmptyBuffer() { |
| 20043 | return this._buffer.length === 0; |
| 20044 | } |
| 20045 | /** |
| 20046 | * Resets the summary buffer without writing to summary file |
| 20047 | * |
| 20048 | * @returns {Summary} summary instance |
| 20049 | */ |
no test coverage detected