A CLI tool that parses HAR (HTTP Archive) data for common web file types and logs the results
- Unzip the files anywhere on your system
$ cd <path-to-harper>
$ npm link
$ cd <path-to-data>/myCustomHarData.json
$ harper --src myCustomHarData.json
By default, if you don't specify a file name the tool will use a sample data file to demonstrate the output. To get your own HAR data you can follow these steps:
- Open Chrome
- Open Chrome's Dev Tools (F12)
- Open the network tab
- Load the page you want to collect data for
- Once you have what you need, right-click on the network tab results and click "Copy all as HAR"
- Paste the data into a file and save as "myCustomHarData.json" (or whatever)
The HAR JSON file you want to parse
$ harper --src data.json
$ harper -s data.json
The options JSON containing domains/paths to include/ignore (see "Harper Options JSON")
$ harper --options options.json
$ harper -o options.json
Determines whether to display a breakdown of data for each extension
$ harper --extensions
$ harper -e
One or more space-separated domains/paths to include exclusively
$ harper --include http://my.special.domain images/includeImage.png
One or more space-separated domains/paths to ignore
$ harper --exclude http://ignored.cdn.com path-to/ignored.json
Shows the help menu
$ harper --help
$ harper -h
If you have a large number of domains/paths to include or ignore, you can pass a path to an options JSON file in order
to specify these strings (see harper/samples/options.json
).
Note: both include and ignore can be specified but include will take precedence.
To load these options, simply place the options.json file in the same directory as your data and run:
$ harper --src myCustomHarData.json --options myOptions.json
The script currently gives a simplistic output of totals for the following file types, including the downloaded size and time taken to transfer the data:
- CSS
- .css
- HTML
- .html
- Fonts
- .eot
- .woff
- .ttf
- .svg
- .otf
- Images
- .gif
- .jpg
- .png
- Scripts
- .js
- JSON
- .json
- Audio
- .aif
- .mpeg
- .midi
- .mp3
- .wav
- Video
- .mov
- .mpeg
- Command line console
- JSON
Note: by default, any file output will be created in whichever folder you execute Harper in the format /.harper/harper.json
- Write some tests for value conversions
- Create alternative output formats (HTML, XML, TXT, etc)