# speedmetrics

> Collect meaningful metrics from Chrome's trace events.

Latest version **0.1.0** (published 2018-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install speedmetrics
pnpm add speedmetrics
yarn add speedmetrics
bun add speedmetrics
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-09-15 |
| First published | 2018-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nicolas Gryman |
| Maintainers | ngryman |
| Keywords | performance, metrics, chrome, devtools, trace |

## Links

- npm: https://www.npmjs.com/package/speedmetrics
- Repository: https://github.com/speedracer/metrics
- npm.io page: https://npm.io/package/speedmetrics

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [stable](https://npm.io/package/stable.md) ^0.1.8

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-09-15

## README

# ![Speed Metrics]()

[![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url]

[travis-image]: https://img.shields.io/travis/speedracer/speedmetrics.svg?style=flat
[travis-url]: https://travis-ci.org/speedracer/speedmetrics
[codecov-image]: https://img.shields.io/codecov/c/github/speedracer/speedmetrics.svg
[codecov-url]: https://codecov.io/github/speedracer/speedmetrics

Collect meaningful metrics from Chrome's trace events.

## Quickstart

### Installation

```sh
npm install speedmetrics
```

### Usage

```js
import collectMetrics from 'speedmetrics'

const metrics = await collectMetrics('trace.json')
console.log(metrics)
```
```js
{
  timings: {
    navigationStart: 0,
    domContentLoaded: 200,
    firstPaint: 400,
    firstContentfulPaint: 400,
    firstMeaningfulPaint: 600,
    load: 1000
  }
  events: {
    /* ... */
  }
}
```

## API

### metrics(filename)

Loads a trace file name and return a promise resolving to collected metrics.

```js
const metrics = await collectMetrics('trace.json')
```

### metrics(traceEvents)

Accepts a trace events object and return a promise resolving to collected metrics.

```js
readFile('trace.json', 'utf8', async (err, data) => {
  const metrics = await collectMetrics(data.traceEvents)
})
```

---
_Source: https://npm.io/package/speedmetrics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
