New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

har-remix

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

har-remix

Server HAR archive with loose matching and hooks to alter responses.

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-81.08%
Maintainers
4
Weekly downloads
 
Created
Source

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);

Keywords

FAQs

Package last updated on 30 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc