Gathering detailed insights and metrics for json-sizeof
Gathering detailed insights and metrics for json-sizeof
Gathering detailed insights and metrics for json-sizeof
Gathering detailed insights and metrics for json-sizeof
npm install json-sizeof
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
5 Stars
35 Commits
2 Watching
6 Branches
1 Contributors
Updated on 07 Oct 2024
Minified
Minified + Gzipped
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-18.9%
116
Compared to previous day
Last week
38.4%
699
Compared to previous week
Last month
-2.5%
2,654
Compared to previous month
Last year
-0.2%
43,468
Compared to previous year
Get the byte size of an object after JSON.stringify
npm i json-sizeof
1const { jsonSizeOf } = require('json-sizeof'); 2 3const obj = { 4 str1: 'I am a string!', 5 obj1: { 6 str2: 456, 7 obj2: null, 8 obj3: undefined 9 }, 10}; 11 12const bytes = jsonSizeOf(obj); 13// expected 57
jsonSizeOf(obj) equals to Buffer.byteLength(JSON.stringify(obj)).
but is faster and less likely to cause "Javascript heap out of memory"
1const obj = {}; 2for (let i = 0;i < 8000000;i++) { 3 obj['test' + i] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 4} 5 6// expected: 342888891 7jsonSizeOf(obj); 8 9// The following line will cause "JavaScript heap out of memory" fatal error 10// if you do not maually increase the memory usage of node app. 11Buffer.byteLength(JSON.stringify(obj));
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More