# @testim/chrome-har

> Create HAR files from Chrome Debugging Protocol data.

Latest version **0.11.3** (published 2020-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @testim/chrome-har
pnpm add @testim/chrome-har
yarn add @testim/chrome-har
bun add @testim/chrome-har
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.3 |
| Published | 2020-10-14 |
| First published | 2020-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.8 MB |
| Known vulnerabilities | 0 (+3 in 3 direct dependencies) |
| Install scripts | no |
| Author | Tobias Lidskog |
| Maintainers | testim |
| Keywords | chrome, har, webperf |

## Links

- npm: https://www.npmjs.com/package/@testim/chrome-har
- Repository: https://github.com/testimio/chrome-har
- Issues: https://github.com/testimio/chrome-har/issues
- npm.io page: https://npm.io/package/@testim/chrome-har

## Dependencies (4)

- [uuid](https://npm.io/package/uuid.md) 3.3.3
- [dayjs](https://npm.io/package/dayjs.md) 1.8.16
- [debug](https://npm.io/package/debug.md) 4.1.1
- [tough-cookie](https://npm.io/package/tough-cookie.md) 4.0.0

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.11.3 (latest) — 2020-10-14
- 0.0.0-6a7c1f3 (canary) — 2020-10-14
- 0.0.0-0dd90a2 — 2020-10-14

## README

# Chrome-har

[![Build status][travis-image]][travis-url]

Create [HAR](http://www.softwareishard.com/blog/har-12-spec/) files based on [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) data.

Code originally extracted from [Browsertime](https://github.com/sitespeedio/browsertime), initial implementation inspired by [Chromedriver_har](https://github.com/woodsaj/chromedriver_har).

## Support for Response Bodies

Chrome-har optionally supports response bodies in HARs if they are set on the [response object](https://chromedevtools.github.io/devtools-protocol/tot/Network#type-Response) by the caller and if the `includeTextFromResponseBody` option is set to `true`.

For example:

```javascript
const harEvents: Array<any> = [];

client.on('Network.requestIntercepted', async (params: any) => {
  // Get the response body
  const response = await client.send(
    'Network.getResponseBodyForInterception',
    { interceptionId: params.interceptionId },
  );

  // Set the body on the response object
  if (params.response != null) {
    params.response.body = response.body;
  } else {
    params.response = response;
  }

  // Continue the request
  await client.send(
    'Network.continueInterceptedRequest',
    { interceptionId: params.interceptionId },
  );

  harEvents.push({ method, params });
});

const har = harFromMessages(harEvents, {includeTextFromResponseBody: true});
```

[travis-image]: https://img.shields.io/travis/sitespeedio/chrome-har.svg?style=flat-square
[travis-url]: https://travis-ci.org/sitespeedio/chrome-har

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