return bites size

This commit is contained in:
Alexander Popov 2023-01-04 23:53:14 +03:00
parent d0065503c4
commit de9ed51968
1 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,11 @@ function getData(value) {
* @param {Array} badgesArray - массив данных о значках
*/
function exportJson(badgesArray) {
console.log(JSON.stringify(badgesArray));
const byteSize = str => new Blob([str]).size;
json = JSON.stringify(badgesArray);
console.log(json);
console.log(`Size: ${byteSize(json)} bytes.`)
}
/**
@ -63,8 +67,6 @@ function getBadges() {
})(document.getElementsByClassName('pagelink'));
while (currentPage <= totalPages) {
console.log(`Parse ${currentPage} page...`);
fetch(`${baseURI}?p=${currentPage}`)
.then((response) => { return response.text(); })
.then((html) => {