https://github.com/joffrey-bion/har-parser
A Kotlin library to parse HAR (HTTP Archive) files
https://github.com/joffrey-bion/har-parser
har kotlin multiplatform-kotlin-library
Last synced: 3 months ago
JSON representation
A Kotlin library to parse HAR (HTTP Archive) files
- Host: GitHub
- URL: https://github.com/joffrey-bion/har-parser
- Owner: joffrey-bion
- License: mit
- Created: 2023-07-15T11:42:41.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-20T21:43:27.000Z (3 months ago)
- Last Synced: 2025-03-20T22:27:46.235Z (3 months ago)
- Topics: har, kotlin, multiplatform-kotlin-library
- Language: Kotlin
- Homepage:
- Size: 409 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# har-parser
[](https://search.maven.org/artifact/org.hildan.har/har-parser)
[](https://github.com/joffrey-bion/har-parser/actions/workflows/build.yml)
[](https://github.com/joffrey-bion/har-parser/blob/main/LICENSE)A Kotlin multiplatform library to parse HAR (HTTP Archive) files, including support for the web socket traffic format.
## Setup
Add the dependency:
```kotlin
dependencies {
implementation("org.hildan.har:har-parser:$version")
}
```## Usage
### Parse HAR text
You can get the data as text first, and then parse it using:
```kotlin
import org.hildan.har.*val harText: String = TODO("get some textual HAR-encoded data")
val har: Har = Har.parse(harText)
```### Parse HAR files
On the JVM, you can use the `Path.readHar()` extension to read a HAR file:
```kotlin
import kotlin.io.path.*
import org.hildan.har.*val harPath = Path("./my-recording.har")
val har: Har = harPath.readHar()har.log.entries.forEach {
println("${it.request.method} ${it.response.status} ${it.request.url}")
}
```You can also write a HAR file using `Path.writeHar(Har)`.