Nosferatu's Pace Maker

    braids

    0.0.4 • Public • Published

    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

    1. Fork it (https://github.com/rhinchey/braids/fork)
    2. Create your feature branch (git checkout -b feature/new-feature)
    3. Commit your changes (git commit -am 'Add a new feature')
    4. Push to the branch (git push origin feature/new-feature)
    5. Create a new Pull Request

    Install

    npm i braids

    DownloadsWeekly Downloads

    2

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    22.2 kB

    Total Files

    8

    Last publish

    Collaborators

    • ryhinchey