UNPKG

pandoras-box

Version:

A small and simple stress testing tool for Ethereum-compatible blockchain networks

34 lines (33 loc) • 1.14 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = __importDefault(require("fs")); const logger_1 = __importDefault(require("../logger/logger")); class outputFormat { constructor(averageTPS, blocks) { this.averageTPS = averageTPS; this.blocks = blocks; } } class Outputter { static outputData(data, path) { logger_1.default.title('\nšŸ’¾ Saving run results initialized šŸ’¾\n'); const blocks = []; data.blockInfo.forEach((block) => { blocks.push(block); }); try { fs_1.default.writeFile(path, JSON.stringify(new outputFormat(data.tps, blocks)), (error) => { if (error) throw error; }); logger_1.default.success(`Run results saved to ${path}`); } catch (e) { logger_1.default.error(`Unable to write output to file: ${e.message}`); } } } exports.default = Outputter;