Apache License 2.0

项目介绍

grafana/har-to-k6 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,采用 Apache License 2.0 许可证,目前获得 167 个 Star、32 次 Fork。

仓库全名
grafana/har-to-k6
开源许可证
Apache License 2.0
Star 数
167
Fork 数
32
未关闭 Issue
20

README 摘要

har-to-k6 Converts LI-HAR and HAR to K6 script. Content Installation Local Installation (recommended) Global Installation Docker Usage CLI Usage Programmatic Usage Browser Usage Specifications Credits Installation Local Installation (recommended) While possible to install globally, we recommend that you, if possible, add the converter to the nodemodules of your test project using: Note that this will require you to…

完整内容见 GitHub 原始 README 或本页 。

常见问题

har-to-k6 用什么语言开发?

主要使用 JavaScript 编写,采用 Apache License 2.0 许可证,目前有 167 个 Star。

har-to-k6 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 har-to-k6 的源码?

可以直接克隆仓库:git clone https://github.com/grafana/har-to-k6.git,默认分支为 master;安装与运行步骤见仓库 README。

har-to-k6 最近还在维护吗?

仓库最近一次更新为 2 天前,当前有 20 个未关闭 Issue;Star 数为 167,可作为社区活跃度的参考。

关于

JSON config representation of k6 script

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
367
价值分
122
活跃状态
活跃

语言占比

Dockerfile
JavaScript

Release

README

har-to-k6 cover image

har-to-k6

Converts LI-HAR and HAR to K6 script.

GitHub Actions Status NPM Version NPM Weekly Downloads DockerHub



Content

Installation

While possible to install globally, we recommend that you, if possible, add the converter to the node_modules of your test project using:

$ npm install --save har-to-k6

Note that this will require you to run the converter with npx har-to-k6 your-har-file or, if you are using an older version of npm, ./node_modules/.bin/har-to-k6 your-har-file.

Global Installation

$ npm install --global har-to-k6

Docker

$ docker pull grafana/har-to-k6:latest

Usage

CLI Usage

Npx
$ npx har-to-k6 archive.har -o my-k6-script.js
From node_modules
$ ./node_modules/.bin/har-to-k6 archive.har -o my-k6-script.js
Global
$ har-to-k6 archive.har -o my-k6-script.js
Docker
$ docker run grafana/har-to-k6:latest archive.har > my-k6-script.js

Programmatic Usage

Converting
const fs = require("fs");
const { liHARToK6Script } = require("har-to-k6");

async function run () {
  const archive = readArchive();
  const { main } = await liHARToK6Script(archive);
  fs.writeFileSync("./load-test.js", main);
}
Validating

Use validate() to run validation alone. Returns without error for a valid archive. Throws InvalidArchiveError for validation failure.

const { InvalidArchiveError, validate } = require("har-to-k6");

const archive = readArchive();
try {
  validate(archive);
} catch (error) {
  if (error instanceof InvalidArchiveError) {
    // Handle invalid archive
  } else {
    throw error;
  }
}

Browser Usage

har-to-k6 can be ran in the browser. This exposes the standard API under harToK6.

Importing as ES module
import { liHARToK6Script } from "har-to-k6";
CommonJS style
const { liHARToK6Script } = require("har-to-k6");
Using a <script> tag

Load standalone.js into your HTML page:

<html>
  <head>
    <title>HAR Converter</title>
    <script src="standalone.js"></script>
    <script src="index.js"></script>
  </head>
</html>
Example

The API is available:

async function run () {
    const archive = readArchive();
    harToK6.validate(archive);
    const { main } = await harToK6.liHARToK6Script(archive);
    displayResult(main);
}

Specifications

Credits

Thanks to bookmoons for creating this tool 🎉

Publishing a new release

This package uses NPM Trusted Publishing. To publish a new release:

  1. Update the version in package.json with npm version patch|minor|major.
  2. Open a new PR with the version change.
  3. Once it’s approved and merged, manually draft a new release in GitHub.
  4. Once the release is ready to be published, the release.yml workflow will be triggered.
  5. Check Dockerhub and NPM for the new version.

评论

暂无评论