added short example

This commit is contained in:
soulgalore 2017-11-12 15:54:36 +01:00
parent a2a028deb7
commit f865c8cb4a
1 changed files with 20 additions and 0 deletions

View File

@ -16,3 +16,23 @@ twitterdescription:
Create [HAR](http://www.softwareishard.com/blog/har-12-spec/) files based on [Chrome Debugging Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol) data.
Code originally extracted from [Browsertime](https://github.com/sitespeedio/browsertime), initial implementation inspired by [Chromedriver_har](https://github.com/woodsaj/chromedriver_har).
## Introduction
Chrome-HAR is for tool makers: Get the log from the Chrome Debugging Protocol and use Chrome-HAR to parse it to a HAR.
## Example
Convert your messages to a HAR file.
~~~
const parser = require('chrome-har');
// you already have the message from Chrome Debugging Protocol
parser.harFromMessages(messages))
.then(har => {
// do whatever you want with the HAR file
})
~~~