braids
v0.0.4
Published
A tool to get data about a site's performance and network requests
Downloads
5
Maintainers
Readme
Braids
A node module and cli to get data about a site's performance and network requests
Installation
npm install braids
Data
Each call to run
will return the following data:
interface SiteData {
url: string;
title: string; // document.title
performance: {
entries: PerformanceEntryList; // array of performance entries. return value of window.performance.getEntries()
timing: PerformanceResourceTiming; // performance timing object. return value of window.perormance.timing
};
coverage: {
[url: string]: { // each resource loaded by the page will be included
usedBytes: number;
totalBytes: number;
};
};
requests: {
url: string;
method: HttpMethod; // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/v1/index.d.ts#L928
headers: Headers; // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/v1/index.d.ts#L927
resourceType: ResourceType; // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/v1/index.d.ts#L936
response?: {
status: number;
headers: Headers; // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/v1/index.d.ts#L92
};
}[]
}
Module Usage example
import { startBrowser, run, stopBrowser } from 'braids';
async function getMySiteData() {
await startBrowser();
const mySiteData = await run('http://www.mysite.com');
const mySiteData2 = await run('http://www.mysite2.com');
stopBrowser();
}
CLI Usage Example
braids run http://www.mysite.com > mysite.json
Development setup
npm install
npm build
Meta
Ryan Hinchey – @ryhinchey
Distributed under the MIT license. See LICENSE.txt
for more information.
https://github.com/ryhinchey/braids
Contributing
- Fork it (https://github.com/rhinchey/braids/fork)
- Create your feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -am 'Add a new feature'
) - Push to the branch (
git push origin feature/new-feature
) - Create a new Pull Request