npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shrink-har

v1.0.3

Published

HTTP Archive files can be large when they contain multiple response bodies. If this content is superfluous to your debugging needs then `shrink-har` allows you create smaller copies of .har files with the response body content stripped out.

Downloads

5

Readme

shrink-har

Version node-current Codacy Badge GitHub issues Known Vulnerabilities Libraries.io dependency status for latest release Downloads Total Downloads/Month Last Commit Licence

shrink-har screenshot

Shrink-HAR is a command line utility that reduces the size of saved HTTP Archive files by removing the response body.

Caution This tool is destructive. If you're using HAR files to debug API responses, or any other payload, then this tool isn't for you. It is only useful if your debugging needs are limited to HTTP request/response headers thereby rendering the response bodies superfluous.

Overview

HTTP Archive files can be large when they contain multiple response bodies. I wrote this tool when I needed to retain dozens of HAR files but was only interested in HTTP headers. The response bodies (images, CSS, Javascript, API JSON, etc) were superfluous to my needs but were the majority of the file sizes.

Shrink-HAR will:

  • Analyse HAR files and report on potential savings.
  • Optionally backup existing HAR files to a ZIP file before shrinking them.
  • Shrink HAR files by stripping them, permanently, of all the response bodies.

Installation

Install globally via npm using:

npm install -g shrink-har

Usage

By default, running shrink-har without any options will result in an analysis of *.har files in the current directory:

shrink-har

This behaviour can be modified via the following options.

--file

--file <filespec>

Specifies a filename or, using wildcards, a file specification.

Default: *.har

e.g.

shrink-har --file www.amazon.co.uk.har

-or-

shrink-har --file *amazon*.har

--directory

--directory <path>

Specifies the target directory.

Default: . (current working directory)

e.g.

shrink-har --directory ~/Downloads/

--commit

--commit

Commit changes to files. If absent only an analysis is performed. A confirmation prompt is also shown, which can be modified with --yes.

Default: false

e.g.

shrink-har --commit

--yes

--yes

Automatically answer "yes" to confirmation prompts. Use with --commit.

Default: false

e.g.

shrink-har --commit --yes

--backup

--backup

Backup all target .har files into a single .zip file before committing changes.

Default: false

e.g.

shrink-har --commit --backup

--verbose

--verbose

Enables verbose output.

Default: false

e.g.

shrink-har --verbose

--debug

--debug

Enables debugging output.

Default: false

e.g.

shrink-har --debug

--no-color

--no-color

Switches off colour output.

--version

--version

Display version number.

--help

--help

Displays help screen.

Examples

Analyse current directory

Analyse *.har in the current directory:

shrink-har

shrink-har


Verbose output of current directory's analysis

Analyse *.har in the current directory displaying verbose output

shrink-har --verbose

shrink-har --verbose


Shrink all HAR files in current directory (interactive)

Shrink *.har in the current directory, with a confirmation prompt

shrink-har --commit

shrink-har --commit


Backup and Shrink all HAR files in current directory (silent)

Shrink *.har in the current directory, with no prompts, after making a backup

shrink-har --commit --yes --backup

shrink-har --commit --yes --backup


Shrink specific file in specific directory (interactive)

Shrink the file www.example.com.har in ./Downloads after a confirmation prompt

shrink-har --file www.example.com.har --directory ./Downloads --commit

shrink-har --file www.example.com.har --directory ./Downloads --commit


Shrink all HAR files in specific directory without backing up (silent)

Shrink *.har in ./Downloads/HARFiles/ without backing up and with no prompt

Warning, this command permanently removes data silently

shrink-har --directory ./Downloads/HARFiles/ --commit --yes

shrink-har --directory ./Downloads/HARFiles/ --commit --yes

Change Log

The Change Log can be found here