Created
September 2, 2021 18:01
-
-
Save getkey/fdf6fff2abbaab77fcc1c5b2602f48d5 to your computer and use it in GitHub Desktop.
Small tool to find out if some URL are loaded twice. Takes a HAR file as an entry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const har = JSON.parse(fs.readFileSync(process.argv[2])); | |
har.log.entries | |
.map(({ request }) => request.url) | |
.reduce((watchlist, url) => { | |
const seenTimes = watchlist.get(url) || 0; | |
watchlist.set(url, seenTimes + 1) | |
return watchlist; | |
}, new Map()) | |
.forEach((seenTimes, url) => { | |
if (seenTimes > 1) { | |
console.log(url, 'seen', seenTimes, 'time(s).'); | |
} | |
}); | |
console.log('Done.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment