{"id":13582809,"url":"https://github.com/grafana/har-to-k6","last_synced_at":"2026-01-16T10:57:00.727Z","repository":{"id":37716478,"uuid":"171713086","full_name":"grafana/har-to-k6","owner":"grafana","description":"JSON config representation of k6 script","archived":false,"fork":false,"pushed_at":"2025-06-12T09:47:12.000Z","size":4407,"stargazers_count":152,"open_issues_count":25,"forks_count":35,"subscribers_count":143,"default_branch":"master","last_synced_at":"2025-10-04T21:38:04.086Z","etag":null,"topics":["har","k6-converter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafana.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-20T16:53:32.000Z","updated_at":"2025-09-12T09:52:52.000Z","dependencies_parsed_at":"2023-02-05T02:00:37.957Z","dependency_job_id":"6664a285-1bc3-4e58-a5e3-a174fce63c99","html_url":"https://github.com/grafana/har-to-k6","commit_stats":null,"previous_names":["loadimpact/har-to-k6"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/grafana/har-to-k6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fhar-to-k6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fhar-to-k6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fhar-to-k6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fhar-to-k6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafana","download_url":"https://codeload.github.com/grafana/har-to-k6/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fhar-to-k6/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000707,"owners_count":26082837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["har","k6-converter"],"created_at":"2024-08-01T15:03:02.692Z","updated_at":"2025-10-08T21:39:36.566Z","avatar_url":"https://github.com/grafana.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Tools"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![har-to-k6 cover image](./assets/har-to-k6-cover.png)\n\n# har-to-k6\nConverts [LI-HAR](li-har.spec.md) and [HAR](https://w3c.github.io/web-performance/specs/HAR/Overview.html) to [K6 script](https://docs.k6.io/docs).\n\n![GitHub Actions Status](https://github.com/grafana/har-to-k6/workflows/Release/badge.svg)\n![NPM Version](https://img.shields.io/npm/v/har-to-k6.svg)\n![NPM Weekly Downloads](https://img.shields.io/npm/dw/har-to-k6.svg)\n![DockerHub](https://img.shields.io/docker/pulls/grafana/har-to-k6.svg)\n\n\u003c/div\u003e\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Content\n- [Installation](#installation)\n  - [Local Installation (recommended)](#local-installation-recommended)\n  - [Global Installation](#global-installation)\n  - [Docker](#docker)\n- [Usage](#usage)\n  - [CLI Usage](#cli-usage)\n  - [Programmatic Usage](#programmatic-usage)\n  - [Browser Usage](#browser-usage)\n- [Specifications](#specifications)\n- [Credits](#credits)\n\n## Installation\n\n### Local Installation (recommended)\n\nWhile possible to install globally, we recommend that you, if possible, add the converter to the\n`node_modules` of your test project using:\n\n```shell\n$ npm install --save har-to-k6\n```\n\nNote that this will require you to run the converter with `npx har-to-k6 your-har-file` or,\nif you are using an older version of npm, `./node_modules/.bin/har-to-k6 your-har-file`.\n\n### Global Installation\n\n```shell\n$ npm install --global har-to-k6\n```\n\n### Docker\n\n```shell\n$ docker pull grafana/har-to-k6:latest\n```\n\n## Usage\n\n### CLI Usage\n\n#### Npx\n```shell\n$ npx har-to-k6 archive.har -o my-k6-script.js\n```\n\n#### From `node_modules`\n\n```shell\n$ ./node_modules/.bin/har-to-k6 archive.har -o my-k6-script.js\n```\n\n#### Global\n\n```shell\n$ har-to-k6 archive.har -o my-k6-script.js\n```\n\n#### Docker\n\n```shell\n$ docker run grafana/har-to-k6:latest archive.har \u003e my-k6-script.js\n```\n\n### Programmatic Usage\n\n#### Converting\n\n```js\nconst fs = require(\"fs\");\nconst { liHARToK6Script } = require(\"har-to-k6\");\n\nasync function run () {\n  const archive = readArchive();\n  const { main } = await liHARToK6Script(archive);\n  fs.writeFileSync(\"./load-test.js\", main);\n}\n```\n\n#### Validating\n\nUse `validate()` to run validation alone. Returns without error for a valid\narchive. Throws `InvalidArchiveError` for validation failure.\n\n```js\nconst { InvalidArchiveError, validate } = require(\"har-to-k6\");\n\nconst archive = readArchive();\ntry {\n  validate(archive);\n} catch (error) {\n  if (error instanceof InvalidArchiveError) {\n    // Handle invalid archive\n  } else {\n    throw error;\n  }\n}\n```\n\n### Browser Usage\n\n`har-to-k6` can be ran in the browser. This exposes the standard\nAPI under `harToK6`.\n\n\n#### Importing as ES module\n```javascript\nimport { liHARToK6Script } from \"har-to-k6\";\n```\n\n#### CommonJS style\n```javascript\nconst { liHARToK6Script } = require(\"har-to-k6\");\n```\n\n#### Using a `\u003cscript\u003e` tag\n\nLoad `standalone.js` into your HTML page:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eHAR Converter\u003c/title\u003e\n    \u003cscript src=\"standalone.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"index.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n\u003c/html\u003e\n```\n\n#### Example\n\nThe API is available:\n\n```js\nasync function run () {\n    const archive = readArchive();\n    harToK6.validate(archive);\n    const { main } = await harToK6.liHARToK6Script(archive);\n    displayResult(main);\n}\n```\n\n## Specifications\n\n\n- [LI-HAR](li-har.spec.md) - Static configuration format representing a\n  [_K6 script_](https://docs.k6.io/docs)\n- [LI-HAR to K6 converter](converter.spec.md) - JavaScript package or function\n  that converts a given [_LI-HAR_](li-har.spec.md) to a\n  [_K6 script_](https://docs.k6.io/docs)\n- [LI-HAR to K6 CLI tool](cli-tool.spec.md) - a Node.js CLI tool exposing an\n  interface for converting a given [_LI-HAR_](li-har.spec.md) to a\n  [_K6 script_](https://docs.k6.io/docs)\n\n## Credits\nThanks to [bookmoons](https://github.com/bookmoons) for creating this tool 🎉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fhar-to-k6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafana%2Fhar-to-k6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fhar-to-k6/lists"}