electron-har 0,0 editorconfig npm

A command-line tool for generating HTTP Archive (HAR) (based on Electron)

3 years after

electron-har

A command-line tool for generating HTTP Archive (HAR) (based on Electron).

The data you get is identical to "Chromium -> Developer Tools -> Network pane -> Save All as HAR".

Installation

Prebuilt binaries can be found on the release(s) page.

You can also use npm:

npm install -g electron-har

In order for Electron to work on Debian/Ubuntu (specifically on Debian 8/Ubuntu 12.04) following packages have to be installed libgtk2.0-0 libgconf-2-4 libasound2 libxtst6 libxss1 libnss3.

Usage

electron-har http://google.com # writes HAR to stdout

# in a headless environment (CI agent on Linux?) - xvfb-run will do just fine 
DISPLAY=:1 xvfb-run electron-har http://google.com -o google_com.har

# to see a complete list of command line options
electron-har --help

... or pragmatically

var electronHAR = require('electron-har');

electronHAR('http://enterprise.com/self-destruct', {
  user: {
    name: 'jean_luc_picard',
    password: 'picard_4_7_alpha_tango'
  }
}, function (err, json) {
  if (err) {
    throw err;
  }
  console.log(json.log.entries);
});

In a headless environment you might want to use kesla/headless (which will start Xvfb for you).

var headless = require('headless');
var electronHAR = require('electron-har');

(function (cb) {
  if (!process.env.DISPLAY) {
    headless(function (err, proc, display) {
      if (err) {
        return cb(err);
      }
      process.env.DISPLAY = ':' + display;
      cb(null, proc);
    })
  } else {
    process.nextTick(cb);
  }
})(function (err, xvfb) {
  if (err) {
    throw err;
  }
  electronHAR(..., function (err, json) {
    ...
    xvfb && xvfb.kill();
  })
});

License

MIT License

Related Repositories

awesome-electron

awesome-electron

Useful resources for creating apps with Electron ...

webrecorderplayer-electron

webrecorderplayer-electron

Webrecorder Player for Desktop (OSX/Windows/Linux). (Built with Electron + Webre ...

awesome-electron

awesome-electron

Useful resources for creating apps with Electron ...

awesome-electron

awesome-electron

Useful resources for creating apps with Electron ...

nightmare-har-plugin

nightmare-har-plugin

Nightmare plugin used to retrieve the network activity of a web page in HAR (HTT ...


Top Contributors

shyiko bmcminn ShyykoSerhiy

Dependencies

package version
cookie ^0.3.1
cross-exec-file ^1.0.0
electron-prebuilt ^0.35.4
json-stable-stringify ^1.0.0
object-assign ^4.0.1
tmp ^0.0.28
yargs ^3.31.0
dev electron-packager ^5.1.1
chai ^3.4.1
mocha ^2.3.4
semistandard ^7.0.4

Releases

-   0.2.0 zip tar
-   0.1.5 zip tar