Fork me on GitHub

YSlow Node Server

YSlow analyzes web pages and why they're slow based on Yahoo!'s rules for high performance web sites

Node.js Server is a YSlow Command Line (HAR) variation powered by Express that provides RESTful API. It also uses HAR files as input source in order to analyze page performance, however unlike Command Line version, HAR can be:

  • a JSON string
  • a local file to be uploaded
  • a file in a remote URL

Installation

YSlow Node.js Server requires:

  1. Node.js obviously
  2. Express, e.g: $ npm install express
  3. YSlow Command Line (HAR), e.g: $ npm install yslow

Once all requirements are installed, you can either:

To run Node.js Server:

$ node yslow-server.js <port>

Help

$ node yslow-server.js 8080
$ curl localhost:8080
{
  help: {
    usage: "http://localhost:8080/?[options][&har=(<HAR as JSON string> | <URL to fetch HAR from> | <HAR file to upload>)]",
    options: [
      "h | help:                 output usage information",
      "V | version:              output the version number",
      "i | info <info>:          specify the information to display/log (basic|grade|stats|comps|all) [basic]",
      "f | format <format>:      specify the output results format (json|xml|plain) [json]",
      "r | ruleset <ruleset>:    specify the YSlow performance ruleset to be used (ydefault|yslow1|yblog) [ydefault]",
      "b | beacon <url>:         specify an URL to log the results",
      "d | dict <true|false>:    include dictionary of results fields [false]",
      "v | verbose <true|false>: output beacon response information [false]"
    ],
    examples: [
      "http://localhost:8080/?har=www.example.com/foo.har",
      "curl 'http://localhost:8080/?info=grade&format=plain' -F 'har=@localfile.har'",
      "curl 'http://localhost:8080/?ruleset=yblog' -d 'har={"log":{"version":"1.1", ... }}'",
      "http://localhost:8080/?info=all&dict=true&beacon=www.beaconserver.com&verbose=true",
      "http://localhost:8080/?har=www.webpagetest.org%2Fexport.php%3Ftest%3DTEST_ID&i=grade&b=www.showslow.com%2Fbeacon%2Fyslow%2F"
    ]
  },
  error: { }
}

Examples

Play with live demo hosted at AppFog