Skip to content

rafacesar/simplehar

Repository files navigation

Simple Har

Har viewer made simple

Build Status

Getting Started

This viewer can be used within a server and accessing index.html in your browser or you can use it as a node app.

You can also access rafacesar.github.io/simplehar and use it online!
To understand how the information is displayed, check the explanation.

The viewer needs Bootstrap(+3.0.0) and jQuery(+2.1.0) to work.

To install it as a node module you can run:

npm install simplehar

Or globally:

npm install -g simplehar

Using as a dependency/programmatically

var simplehar = require('simplehar'),
	path = require('path'),
	harFile = path.join('harFolder', 'myHarFile.har'),
	htmlFile = path.join('htmlFolder', 'myHtmlFile.html');

simplehar({
	har:harFile,
	html:htmlFile,
	lng:false
});


//<style>...</style>...html...<script>...</script>
var result = simplehar({
	har:harFile,
	html:htmlFile,
	lng:false,
	frame:true,
	return:true
});


//[
//	<style>...</style>...html...<script>...</script>,
//	<style>...</style>...html...<script>...</script>
//]
var result = simplehar({
	har:multipleSitesHarFile,
	lng:false,
	frame:true,
	return:true
});


//{
//	css:'...',
//	js:'...',
//	html:'...'
//}
var result = simplehar({
	har:harFile,
	html:htmlFile,
	lng:false,
	frame:true,
	return:true,
	frameContent:{
		css:false,
		js:false
	}
});

//{
//	css:'...',
//	js:'...',
//	html:['...', '...']
//}
var result = simplehar({
	har:multipleSitesHarFile,
	lng:false,
	frame:true,
	return:true,
	frameContent:{
		css:false,
		js:false
	}
});

Using command line

After installed you can simply run:

node ./node_module/.bin/simplehar <harFile>

Or:

node ./node_module/.bin/simplehar <harFile> <htmlFile>

Or a complete command:

node ./node_module/.bin/simplehar <htmlFile> <harFile> lng=pt-BR frame

Or globally:

simplehar <harFile>

Parameters

harFile (Required)

Har source to be used as base (it needs the .har extension)

htmlFile (Optional)

Html file to be generate with the har informations (it needs the .html extension) Via Command Line:

This parameter will be ignored when using multiple sites in one harFile

Via Programmatically (when using multiple sites)

The string {id} will be replaced by the id of the page on harFile. If the {id} is missing, this parameter will be ignored

frame (Optional)

This option genarate a html file just with the div content, embedding the CSS and JS necessary to viewer work.

This options is good for embedding the html in another page. But the page must already have bootstrap and jQuery loaded.

lng (Optional)

Language used to translate (from src/translate.json) (e.g pt-BR)

frameContent (Optional - Used only as dependency/programmatically)

Object specifying if the html should have JS or CSS inline