{"id":48219121,"url":"https://github.com/idan-at/native-sizeof","last_synced_at":"2026-04-04T19:03:37.691Z","repository":{"id":44764148,"uuid":"368877722","full_name":"idan-at/native-sizeof","owner":"idan-at","description":"A native package to quickly calculate a JS object size","archived":false,"fork":false,"pushed_at":"2022-01-26T14:04:21.000Z","size":244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-14T14:20:41.594Z","etag":null,"topics":["javascript","memory","rust","size-calculation","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idan-at.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-19T13:24:09.000Z","updated_at":"2022-01-26T10:28:06.000Z","dependencies_parsed_at":"2022-09-19T05:21:31.523Z","dependency_job_id":null,"html_url":"https://github.com/idan-at/native-sizeof","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/idan-at/native-sizeof","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idan-at%2Fnative-sizeof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idan-at%2Fnative-sizeof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idan-at%2Fnative-sizeof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idan-at%2Fnative-sizeof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idan-at","download_url":"https://codeload.github.com/idan-at/native-sizeof/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idan-at%2Fnative-sizeof/sbom","scorecard":{"id":480864,"data":{"date":"2025-08-11","repo":{"name":"github.com/idan-at/native-sizeof","commit":"ec1a6d32c36f7c4a92977274d529f2dc266359fe"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/idan-at/native-sizeof/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/idan-at/native-sizeof/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/idan-at/native-sizeof/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.1.6 not signed: https://api.github.com/repos/idan-at/native-sizeof/releases/58013546","Warn: release artifact 0.1.5 not signed: https://api.github.com/repos/idan-at/native-sizeof/releases/58010343","Warn: release artifact 0.1.4 not signed: https://api.github.com/repos/idan-at/native-sizeof/releases/43284712","Warn: release artifact 0.1.3 not signed: https://api.github.com/repos/idan-at/native-sizeof/releases/43284320","Warn: release artifact 0.1.2 not signed: https://api.github.com/repos/idan-at/native-sizeof/releases/43279120","Warn: release artifact 0.1.6 does not have provenance: https://api.github.com/repos/idan-at/native-sizeof/releases/58013546","Warn: release artifact 0.1.5 does not have provenance: https://api.github.com/repos/idan-at/native-sizeof/releases/58010343","Warn: release artifact 0.1.4 does not have provenance: https://api.github.com/repos/idan-at/native-sizeof/releases/43284712","Warn: release artifact 0.1.3 does not have provenance: https://api.github.com/repos/idan-at/native-sizeof/releases/43284320","Warn: release artifact 0.1.2 does not have provenance: https://api.github.com/repos/idan-at/native-sizeof/releases/43279120"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"21 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: RUSTSEC-2022-0028 / GHSA-8mj7-wxmc-f424","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T16:35:19.274Z","repository_id":44764148,"created_at":"2025-08-19T16:35:19.274Z","updated_at":"2025-08-19T16:35:19.274Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31409471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","memory","rust","size-calculation","typescript"],"created_at":"2026-04-04T19:03:36.580Z","updated_at":"2026-04-04T19:03:37.650Z","avatar_url":"https://github.com/idan-at.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# native-sizeof\n\n[![npm version](https://badge.fury.io/js/native-sizeof.svg)](https://badge.fury.io/js/native-sizeof)\n[![Actions Status: build](https://github.com/idan-at/native-sizeof/workflows/test/badge.svg)](https://github.com/idan-at/native-sizeof/actions?query=workflow%3A\"test\")\n\nA native package to quickly calculate an object size, written in Rust.\n\n## Installation\n`npm install --save native-sizeof`\n\n## Usage\n```js\nconst { sizeof } = require('native-sizeof');\n\nconst object = {\n  'key': 'value'\n}\n\nsizeof(object); // returns the size of the object (8 character =\u003e 2 * 8 = 16)\nsizeof(\"hello\"); // 5 * 2 = 10\nsizeof(123) // 8 for a number\nsizeof(true) // 2 for a boolean\n\nsizeof(null) // 0 for null, undefined\n```\n\n## Summary\n\nIn javascript, there is no manual memory management, and therefore no `sizeof` capabilities, unlike C and other system languages.\n\nHowever, sometimes it is useful to know how much size your object takes, so it will provide an approximation of how much memory is confused by your app, and how much memory is actually needed by your VM / Container.\n\nSince iterating over an object and summing up the occupied memory is a synchronous task, which blocks the main thread, this library is written in Rust for  better performance.\n\n## Object size calculation\nAccording to the [ECMAScript® Language Specification](https://tc39.es/ecma262/):\n- Each `boolean` value is represented using **2 bytes**.\n- Each `number` value is represented using **8 bytes**.\n- Each `string` value is represented using **2 bytes per character**. (so a string of length 3 takes 2 * 3 = 6 bytes).\n\nNOTE: Some JS engines might optimize those numbers, but those are a good upper bound.\n\n## Development\n\n### Prerequisites\n- Node (at least 12)\n- Rust (stable)\n\n### Building\n- `npm install`\n\nThis will install the relevant development packages from npm and will build the binary from the rust code.\n\n### Testing\n- `npm test`\n\nThis runs both Rust tests and JS integration tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidan-at%2Fnative-sizeof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidan-at%2Fnative-sizeof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidan-at%2Fnative-sizeof/lists"}