https://github.com/golang-infrastructure/go-har
HAR(HTTP Archive format)HTTP归档格式文件的Golang解析库
https://github.com/golang-infrastructure/go-har
har
Last synced: 3 months ago
JSON representation
HAR(HTTP Archive format)HTTP归档格式文件的Golang解析库
- Host: GitHub
- URL: https://github.com/golang-infrastructure/go-har
- Owner: golang-infrastructure
- License: mit
- Created: 2022-12-07T02:31:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T07:08:15.000Z (over 2 years ago)
- Last Synced: 2025-01-18T16:11:03.450Z (5 months ago)
- Topics: har
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HAR(HTTP Archive format)HTTP归档格式文件的Golang解析库
# 一、安装
```bash
go get -u github.com/golang-infrastructure/go-har
```# 二、代码示例
```go
package mainimport (
"fmt"
"github.com/golang-infrastructure/go-har"
"os"
)func main() {
harFilePath := "./data/www.google.com.har"
// 用法一:解析HAR文件的字节
harFileBytes, err := os.ReadFile(harFilePath)
if err != nil {
fmt.Println(err)
return
}
harFile, err := har.ParseHar(harFileBytes)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(harFile)// 用法二:给定HAR文件的路径解析它
harFile002, err := har.ParseHarFile(harFilePath)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(harFile002)}
```