Skip to content

Cheat sheet for extracting information from HAR files using JQ

License

Notifications You must be signed in to change notification settings

Pixboost/har-jq-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

har-jq-cheatsheet

Cheat sheet for extracting information from HAR files using JQ.

HAR is "HTTP Archive" that contains detailed information about requests and responses.

To get HAR file:

  • Open Google Chrome Dev Tools on the page (F12)

  • Go to "Network Tab"

  • Right click -> Copy -> Copy all as HAR

  • Paste into a new JSON fil.

  • Listing all images with size and times

.log.entries[] | 
  {"url": .request.url, "time": .time, "size": .response.content.size} | 
  select(.url | match("png|jpg|PNG|JPG|jpeg|JPEG"))
  • Count all images requests
[
  .log.entries[] | 
  select(.request.url | match("png|jpg|PNG|JPG|jpeg|JPEG"))
] | length
  • Count total time for all loaded images including queueing
[
  .log.entries[] | 
  select(.request.url |
    match("png|jpg|PNG|JPG|jpeg|JPEG")
  ) | {time: .time}
] | reduce(.[]) as $i (0; . += $i.time)
  • Count total time for all loaded images without queueing
[
  .log.entries[] |
  select(.request.url |
    match("png|jpg|PNG|JPG|jpeg|JPEG")
  ) | {time: .time, t: .timings} 
] | reduce(.[]) as $i (0; . += ($i.t.receive - $i.t._blocked_queueing + $i.t.send + $i.t.wait + $i.t.blocked))
  • Count number of bytes transferred by images
[
  .log.entries[] |
  select(.request.url |
    match("png|jpg|PNG|JPG|jpeg|JPEG")
  ) | {r: .response} 
] | reduce(.[]) as $i (0; . += $i.r._transferSize)

Releases

No releases published

Packages

No packages published

Languages