{"id":18886402,"url":"https://github.com/pmem/libpmemobj-js","last_synced_at":"2025-04-14T21:31:07.175Z","repository":{"id":44143911,"uuid":"168905978","full_name":"pmem/libpmemobj-js","owner":"pmem","description":"JavaScript bindings for libpmemobj","archived":false,"fork":false,"pushed_at":"2022-12-09T01:21:52.000Z","size":136,"stargazers_count":7,"open_issues_count":3,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-28T02:42:32.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-03T03:38:21.000Z","updated_at":"2019-11-20T08:30:06.000Z","dependencies_parsed_at":"2023-01-25T17:00:06.868Z","dependency_job_id":null,"html_url":"https://github.com/pmem/libpmemobj-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Flibpmemobj-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Flibpmemobj-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Flibpmemobj-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmem%2Flibpmemobj-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmem","download_url":"https://codeload.github.com/pmem/libpmemobj-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223647069,"owners_count":17179206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-08T07:27:15.794Z","updated_at":"2024-11-08T07:27:16.476Z","avatar_url":"https://github.com/pmem.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PROJECT NOT UNDER ACTIVE MANAGEMENT #  \nThis project will no longer be maintained by Intel.  \nThis project has been identified as having known security escapes.  \nIntel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.  \nIntel no longer accepts patches to this project.  \n  \n# **libpmemobj-js: Persistent Memory Development Kit for JavaScript\\***\n\nThe **Persistent Memory Development Kit for JavaScript\\* (libpmemobj-js)** is a project to provide a Node.js module to store JavaScript objects in persistent memory. One of the goal of the project is to make programming with persistent JavaScript objects feels natural to developer. We have implemented persistent JavaScript classes including PersistentObject, PersistentArray and PersistentArrayBuffer, however they are not fully performance-optimized. Please see our [examples](#Example) and [API document](https://github.com/pmem/libpmemobj-js/blob/master/API-document.md) for details.\n\nThis module uses the libpmemobj library from the Persistent Memory Development Kit (PMDK). For more information on PMDK, please visit http://pmem.io and https://github.com/pmem/pmdk.\n\n## Dependencies\n\n+ Node.js 8.x or higher\n+ [PMDK](https://github.com/pmem/pmdk) - native persistent memory libraries\n+ [node-addon-api](https://github.com/nodejs/node-addon-api) - header-only C++ wrapper classes which simplify the use of the C based [N-API](https://nodejs.org/dist/latest/docs/api/n-api.html) provided by Node.js \n+ [bindings](https://github.com/TooTallNate/node-bindings) - Helper module for loading native module's .node file\n+ Use only for testing\n  + [mocha](https://github.com/mochajs/mocha) - test framework\n\n## BUILD \u0026 TEST\n\n### Get the Codes\n\n```\n$ git clone https://github.com/pmem/libpmemobj-js.git\n$ cd libpmemobj-js\n```\n\n### Build libpmemobj-js\n\nYou can build the dependency to PMDK by using our script, then install libpmemobj-js by npm\n\n```\n$ cd deps\n$ ./buildall.sh\n$ cd ../src\n$ npm install\n```\n### TEST\n\nAfter build, you can run the tests by\n\n```\n$ LD_LIBRARY_PATH=/usr/local/lib mocha ../tests\n```\n\n## Example\n\nWe are using memory to [emulate a persistent memory](http://pmem.io/2016/02/22/pm-emulation.html).\n\n```javascript\n\nconst jspmdk = require('jspmdk');\nconst constants = jspmdk.constants;\n\n// you should specify your own path to persistent memory here\nvar path = '/path/to/pmem/file';\nvar pool = jspmdk.new_pool(path, constants.MIN_POOL_SIZE);\n\nvar check = pool.check();\nif (check == -1) {\n  // not exists\n  pool.create();\n}\nelse if (check == 0) {\n  // not consistent\n}\nelse if (check == 1) {\n  // exists and consistent\n  pool.open();\n}\n\nvar root = pool.root;\npool.root = undefined;\n\n// persistent Object\nvar pobj = pool.create_object({a: 1});\nvar a = pobj.a;\npobj.b = 2;\ndelete pobj.b;\n\n// persistent Array\nvar parr = pool.create_object([1, 2]);\nif (parr.is_array()) {\n  parr.push(3);\n  parr.pop();\n}\n\n// persistent ArrayBuffer\nvar pab = pool.create_arraybuffer(new ArrayBuffer(10));\nvar pab_uint8 = new Uint8Array(pab);\npab_uint8[0] = 1;\npab.persist(0, 1)\n\n// close object pool\npool.close();\n```\n\n\n\u003c!-- ## Install clang-format hook\ncd scripts\n./git-pre-commit-format install --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmem%2Flibpmemobj-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmem%2Flibpmemobj-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmem%2Flibpmemobj-js/lists"}