8.0.0 • Published 2 years ago

har-remix v8.0.0

Weekly downloads
536
License
BSD-2-Clause
Repository
github
Last release
2 years ago

HAR-Remix

HAR-Remix allows the offline serving of HTTP Archive (HAR) files.

Many browsers (Chrome, Firefox) provide archive files that contain everything needed to load a page offline without accessing external resources. This is necessary for obtaining a high p-value (confidence) in the delta between code in master and code you‘re seeking to introduce into the codebase. Depending upon assets or external resources like images, tracking, advertisements, stylesheets, script files, icons, etc. is unpredictable and muddies the result of the site’s performance. What we want to see is how the site, having to download no content, can consistently be loaded and its load's performance evaluated and logged for further representation.

Through the use of the HAR Remix tool, we can serve HAR files as offline pages and evaluate them.

Basic Implementation

Easily serve HAR archive with loose matching and alterations.

You can save a HAR archive with content from the Network tab of Chrome by right clicking the recorded responses.

import HARRemix from "har-remix";
import * as url from "url";

let harRemix = new HARRemix({
  keyForArchiveEntry(entry) {
    let { request, response } = entry;
    let { status } = response;
    if (status >= 200 && status < 300 && request.method !== "OPTIONS") {
      return request.method + url.parse(request.url).path;
    }
  },

  keyForServerRequest(req) {
    return req.method + req.url;
  },

  textFor(entry, key, text) {
    if (key === "GET/") {
      return text.replace(/my-cdn.com/, "localhost:6789");
    }
    return text;
  }
});

harRemix.loadArchive("my-site.com.har");

harRemix.createServer().listen(6789);
8.0.0

2 years ago

7.0.0

2 years ago

6.1.2

2 years ago

6.1.1

2 years ago

6.1.0

3 years ago

6.0.0

3 years ago

5.3.6

3 years ago

5.3.5

3 years ago

5.3.4

3 years ago

5.3.3

3 years ago

5.3.2

3 years ago

5.3.1

3 years ago

5.3.0

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.0

3 years ago

4.5.5

3 years ago

4.5.4

3 years ago

4.5.3

3 years ago

4.5.2

3 years ago

4.5.1

3 years ago

4.1.2

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.12

4 years ago

4.0.11

4 years ago

4.0.10

4 years ago

4.0.9

4 years ago

4.0.8

4 years ago

4.0.7

4 years ago

4.0.6

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.1.2

4 years ago

3.0.16

4 years ago

3.0.14

4 years ago

3.0.12

4 years ago

3.0.13

4 years ago

3.0.0

4 years ago

2.3.0

5 years ago

2.0.1

5 years ago

2.0.0-beta.16

5 years ago

2.0.0-beta.15

5 years ago

2.0.0-beta.6

5 years ago

2.0.0-beta.4

5 years ago

2.0.0-beta.3

5 years ago

2.0.0-beta.2

5 years ago

2.0.0-beta.1

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago