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 🙏

© 2026 – Pkg Stats / Ryan Hefner

workhar

v0.0.4

Published

Convert HAR files to modular JSON fixtures and back. Perfect for snapshotting and mocking API responses in your test suite.

Readme

Workhar

Workhar is an open-source CLI and TypeScript library for converting .har files into editable .json response fixtures — and back again.

Designed for use in test environments and mock servers, it allows you to extract JSON responses from HAR file network requests into individual .json files, then rebuild those .json files into usable HAR files when needed.


Installation

Install locally for programmatic or project-level CLI use:

npm install --save-dev workhar

Or install globally to use the CLI anywhere:

npm install -g workhar

Concepts

Workhar supports two operations:

HAR → JSON (har2json)

  • Extracts JSON responses from a .har file
  • Replaces the HAR content with a relative file path
  • Saves original response bodies in json/ as individual files
  • Stores the full HAR structure in a .workhar file

JSON → HAR (json2har)

  • Reads a .workhar file and matching json/ files
  • Injects content back into the HAR responses
  • Outputs a rebuilt HAR file ready for mocking

Example File Structure

After extraction:

output/
├── .workhar
└── json/
    └── https:/
        └── api.example.com/
            └── users/
                └── getUser_0.json

You can edit the .json files directly, then regenerate a new HAR using the .workhar map.


CLI Usage

workhar har2json <harFile> <workHarFile> [options]
workhar json2har <workHarFile> <harFile> [options]

HAR → JSON

workhar har2json ./recording.har ./output/.workhar --json ./output/json

JSON → HAR

workhar json2har ./output/.workhar ./hydrated.har --json ./output/json

Programmatic API

import { har2json, json2har } from 'workhar';

// Convert HAR to editable .json responses
await har2json({
  fromHarFile: './recording.har',
  toWorkharFile: './output/.workhar',
  withJsonDirectory: './output/json',
});

// Rebuild HAR from modified JSON
await json2har({
  fromWorkharFile: './output/.workhar',
  withJsonDirectory: './output/json',
  toHarFile: './hydrated.har',
});

File Outputs

  • .workhar: A structured JSON representation of the original HAR with response bodies replaced by file paths
  • json/: The extracted responses, organized by request URL and operation

How It Works

When extracting:

  • Reads the HAR entries
  • Skips non-JSON responses
  • For GraphQL, appends the operation name to the output path
  • Saves each JSON response to a file, and replaces the original response in the HAR with its relative path

When rebuilding:

  • Loads the .workhar map and json/ responses
  • Replaces the relative file paths in the HAR with actual JSON content
  • Produces a new HAR file with real responses

Testing

Workhar is fully tested with Vitest:

npm run test

Use Cases

  • Redacting or editing HAR files for sharing
  • Easier modification of HAR files
  • Replacing HAR content at runtime or test-time
  • E2E testing with deterministic mock data

License

MIT © 2025