return bites size

This commit is contained in:
Alexander Popov 2023-01-04 23:53:14 +03:00
parent d0065503c4
commit de9ed51968

View File

@ -44,7 +44,11 @@ function getData(value) {
* @param {Array} badgesArray - массив данных о значках * @param {Array} badgesArray - массив данных о значках
*/ */
function exportJson(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')); })(document.getElementsByClassName('pagelink'));
while (currentPage <= totalPages) { while (currentPage <= totalPages) {
console.log(`Parse ${currentPage} page...`);
fetch(`${baseURI}?p=${currentPage}`) fetch(`${baseURI}?p=${currentPage}`)
.then((response) => { return response.text(); }) .then((response) => { return response.text(); })
.then((html) => { .then((html) => {