Collect meaningful metrics from Chrome's trace events.
npm install speedmetrics
import collectMetrics from 'speedmetrics'
const metrics = await collectMetrics(trace.traceEvents)
console.log(metrics)
{
timings: {
navigationStart: 0,
domContentLoaded: 200,
firstPaint: 400,
firstContentfulPaint: 400,
firstMeaningfulPaint: 600,
load: 1000
}
events: {
/* ... */
}
}
Accepts a trace events object and return collected metrics.
readFile('trace.json', 'utf8', async (err, data) => {
const metrics = await collectMetrics(data.traceEvents)
})