{"id":13538654,"url":"https://github.com/allenluce/mmap-object","last_synced_at":"2026-01-26T16:30:48.969Z","repository":{"id":3922370,"uuid":"51322246","full_name":"allenluce/mmap-object","owner":"allenluce","description":"Shared Memory Objects for Node","archived":false,"fork":false,"pushed_at":"2023-03-02T23:04:06.000Z","size":488,"stargazers_count":115,"open_issues_count":10,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-12T04:41:42.572Z","etag":null,"topics":["javascript-objects","mmap","nodejs","shared-memory"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/allenluce.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,"governance":null}},"created_at":"2016-02-08T19:47:08.000Z","updated_at":"2025-07-25T09:59:21.000Z","dependencies_parsed_at":"2022-08-20T01:51:24.467Z","dependency_job_id":"ebb7ce9c-039b-481b-8a2c-09d0f4736d0d","html_url":"https://github.com/allenluce/mmap-object","commit_stats":{"total_commits":85,"total_committers":7,"mean_commits":"12.142857142857142","dds":"0.43529411764705883","last_synced_commit":"ca54d9d340dbac308df1681e36303f083d65cd93"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/allenluce/mmap-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenluce%2Fmmap-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenluce%2Fmmap-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenluce%2Fmmap-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenluce%2Fmmap-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allenluce","download_url":"https://codeload.github.com/allenluce/mmap-object/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenluce%2Fmmap-object/sbom","scorecard":{"id":185340,"data":{"date":"2025-08-11","repo":{"name":"github.com/allenluce/mmap-object","commit":"ca54d9d340dbac308df1681e36303f083d65cd93"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/29 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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/tests.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":"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/allenluce/mmap-object/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/allenluce/mmap-object/tests.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/tests.yml:25","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 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":"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 1.5.0 not signed: https://api.github.com/repos/allenluce/mmap-object/releases/29584310","Warn: release artifact 1.4.2 not signed: https://api.github.com/repos/allenluce/mmap-object/releases/18050321","Warn: release artifact 1.4.1 not signed: https://api.github.com/repos/allenluce/mmap-object/releases/12277362","Warn: release artifact 1.4.0 not signed: https://api.github.com/repos/allenluce/mmap-object/releases/11659214","Warn: release artifact 1.3.8 not signed: https://api.github.com/repos/allenluce/mmap-object/releases/10743125","Warn: release artifact 1.5.0 does not have provenance: https://api.github.com/repos/allenluce/mmap-object/releases/29584310","Warn: release artifact 1.4.2 does not have provenance: https://api.github.com/repos/allenluce/mmap-object/releases/18050321","Warn: release artifact 1.4.1 does not have provenance: https://api.github.com/repos/allenluce/mmap-object/releases/12277362","Warn: release artifact 1.4.0 does not have provenance: https://api.github.com/repos/allenluce/mmap-object/releases/11659214","Warn: release artifact 1.3.8 does not have provenance: https://api.github.com/repos/allenluce/mmap-object/releases/10743125"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 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":"13 existing vulnerabilities detected","details":["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-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36"],"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-16T19:42:54.642Z","repository_id":3922370,"created_at":"2025-08-16T19:42:54.642Z","updated_at":"2025-08-16T19:42:54.642Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28782167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"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-objects","mmap","nodejs","shared-memory"],"created_at":"2024-08-01T09:01:14.557Z","updated_at":"2026-01-26T16:30:48.954Z","avatar_url":"https://github.com/allenluce.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Shared Memory Objects\n\n[![Build Status](https://travis-ci.org/allenluce/mmap-object.svg?branch=master)](https://travis-ci.org/allenluce/mmap-object)\n\nSuper-fast file-based sharing of Javascript objects among multiple\nprocesses.\n\nThis module maps Javascript objects into shared memory for\nsimultaneous access by different Node processes running on the same\nmachine. Shared memory is loaded\nvia [mmap](https://en.wikipedia.org/wiki/Mmap).  Object access is\nmediated by Boost's unordered map class so object property access are\nspeedy.\n\nData is lazily loaded piece-by-piece as needed so opening even a huge\nfile takes no time at all.\n\nThere are two modes:\n\n## Unshared Write-only Mode\n\nA single process creates a new file which is mapped to a Javascript\nobject. Setting properties on this object writes those properties to\nthe file. You *can* read from the object within this mode but sharing\nan object in write-only mode with other processes is certain to result\nin crashes.\n\n## Shared Read-only mode\n\nOpen an existing file for reading. Multiple processes can safely open\nthis file. Opening is lightning fast and only a single copy remains in\nmemory.\n\n## Faster performance with buffers\n\nIf you use lengthy data values,\n[buffers](https://nodejs.org/api/buffer.html) can speed things up\nconsiderably. In rough benchmarking, a 300% speedup was see when\nreading 20k-byte values as buffers instead of strings. For 200k-byte\nvalues, the speedup was 2000%.\n\n## Requirements\n\nBinaries are provided for OSX and Linux for various node versions\n(check the releases page to see which). If a binary is not provided\nfor your platform, you will need Boost and and a C++11 compliant\ncompiler (like GCC 4.8 or better) to build the module.\n\n## Installation\n\n    npm install mmap-object\n\n## Usage\n\n```javascript\nconst Shared = require('mmap-object')\nconst shared_object = new Shared.Create('filename')\n\nshared_object['new_key'] = 'a string value'\nshared_object.new_property = Buffer.from('a buffer value, supporting Unicode™')\nshared_object['useless key'] = 0\n\n// Erase a key\ndelete shared_object['useless_key']\nshared_object.close()\n\n// Read a file\nconst read_only_shared_object = new Shared.Open('filename')\nconsole.log(`My value is ${read_only_shared_object.new_key}`)\nconsole.log(`My other value is ${read_only_shared_object.new_property}`)\n\nread_only_shared_object.close()\n```\n\n## API\n\n### new Create(path, [file_size], [initial_bucket_count], [max_file_size])\n\nCreates a new file mapped into shared memory. Returns an object that\nprovides access to the shared memory. Throws an exception on error.\n\n__Arguments__\n\n* `path` - The path of the file to create\n* `file_size` - *Optional* The initial size of the file in\n  kilobytes. If more space is needed, the file will automatically be\n  grown to a larger size. Minimum is 500 bytes. Defaults to 5\n  megabytes.\n* `initial_bucket_count` - *Optional* The number of buckets to\n  allocate initially. This is passed to the underlying\n  [Boost unordered_map](http://www.boost.org/doc/libs/1_38_0/doc/html/boost/unordered_map.html).\n  Defaults to 1024. Set this to the number of keys you expect to write.\n* `max_file_size` - *Optional* The largest the file is allowed to grow\n  in kilobites. If data is added beyond this limit, an exception is\n  thrown.  Defaults to 5 gigabytes.\n\n__Example__\n\n```js\n// Create a 500K map for 300 objects.\nconst obj = new Shared.Create('/tmp/sharedmem', 500, 300)\n```\n\n### new Open(path)\n\nMaps an existing file into shared memory. Returns an object that\nprovides read-only access to the object contained in the file. Throws\nan exception on error. Any number of processes can open the same file\nbut only a single copy will reside in memory. Uses `mmap` under the\ncovers, so only those parts of the file that are actually accessed\nwill be loaded.\n\n__Arguments__\n\n* `path` - The path of the file to open\n\n__Example__\n\n```js\n// Open up that shared file\nconst obj = new Shared.Open('/tmp/sharedmem')\n```\n\n### close()\n\nUnmaps a previously created or opened file. If the file was most\nrecently opened with `Create()`, `close()` will first shrink the file\nto remove any unneeded space that may have been allocated.\n\nIt's important to close your unused shared files in long-running\nprocesses. Not doing so keeps shared memory from being freed.\n\nThe closing of very large objects (a few gigabytes and up) may take\nsome time (hundreds to thousands of milliseconds). To prevent blocking\nthe main thread, pass a callback to `close()`. The call to `close()`\nwill return immediately while the callback will be called after the\nunderlying `munmap()` operation completes. Any error will be given as\nthe first argument to the callback.\n\n__Example__\n\n```js\nobj.close(function (err) {\n  if (err) {\n    console.error(`Error closing object: ${err}`)\n  }\n})\n```\n\n### Iteration\n\nThe [iterable\nprotocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol)\nis supported for efficient iteration over the entire contents of the\nobject:\n\n```js\nconst Shared = require('mmap-object')\nconst obj = new Shared.Open('filename')\n\nfor (let [key, value] of obj) {\n    console.log(`${key} =\u003e ${value}`)\n}\n```\n\n(This ES6 syntax is supported in Node 6+, for previous versions of\nnode a more laborious syntax is necessary.)\n\n### isData()\n\nWhen iterating, use `isData()` to tell if a particular key is real\ndata or one of the underlying methods on the shared object:\n\n```js\nconst obj = new Shared.Open('/tmp/sharedmem')\n\nfor (let key in obj) {\n  if (obj.isData(key)) { // Only show actual data\n      console.log(key + ': ' + obj[key])\n  }\n}\n```\n\n\n### isOpen()\n\nReturn true if this object is currently open.\n\n### isClosed()\n\nReturn true if this object has been closed.\n\n### get_free_memory()\n\nNumber of bytes of free storage left in the shared object file.\n\n### get_size()\n\nThe size of the storage in the shared object file, in bytes.\n\n### bucket_count()\n\nThe number of buckets currently allocated in the underlying hash structure.\n\n### max_bucket_count()\n\nThe maximum number of buckets that can be allocated in the underlying hash structure.\n\n### load_factor()\n\nThe average number of elements per bucket.\n\n### max_load_factor()\n\nThe current maximum load factor.\n\n## Unit tests\n\n    npm test\n\n## Limitations\n\n_It is strongly recommended_ to pass in the number of keys you expect\nto write when creating the object with `Create`. If you don't do this,\nthe object will resize as you fill it up. This can be a very\ntime-consuming process and can result in fragmentation within the\nshared memory object and a larger final file size.\n\nObject values may be only string, buffer, or number values. Attempting\nto set a different type value results in an exception.\n\nSymbols are not supported as properties.\n\n## Publishing a binary release\n\nTo make a new binary release:\n\n- Edit package.json. Increment the `version` property.\n- `node-pre-gyp rebuild`\n- `node-pre-gyp package`\n- `node-pre-gyp-github publish`\n- `npm publish`\n\nYou will need a `NODE_PRE_GYP_GITHUB_TOKEN` with `repo:status`,\n`repo_deployment` and `public_repo` access to the target repo. You'll\nalso need write access to the npm repo.\n\n## MSVS build prerequisites\n\nSet up [Boost](http://www.boost.org/).\n\nSet BOOST_ROOT environment variable.\n\n```\nbootstrap\nb2 --build-type=complete\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenluce%2Fmmap-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallenluce%2Fmmap-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenluce%2Fmmap-object/lists"}