browsermob-proxy-api-client
v2.0.0
Published
Client library for [BrowserMob Proxy] API
Downloads
347
Readme
BrowserMob Proxy API Client
Client library for BrowserMob Proxy API
Refer to REST API section of BrowserMob Proxy documentation for detailed information
Installing
Using npm:
$ npm install browsermob-proxy-api-client
Using yarn:
$ yarn add browsermob-proxy-api-client
Example
import BrowserMobProxyAPIClient from 'browsermob-proxy-api-client';
const proxy = new BrowserMobProxyAPIClient('localhost', '8080');
const port = await proxy.start();
if (port) {
try {
await proxy.startHar(port);
// exec `curl google.com --proxy localhost:${port}`
const har = await proxy.getHar(port);
} catch (e) {
console.error(e);
} finally {
await proxy.stop(port);
}
}