{"id":13630254,"url":"https://github.com/Level/party","last_synced_at":"2025-04-17T13:31:51.714Z","repository":{"id":14205271,"uuid":"16911954","full_name":"Level/party","owner":"Level","description":"Open a leveldb handle multiple times.","archived":false,"fork":false,"pushed_at":"2023-02-01T22:02:09.000Z","size":62,"stargazers_count":146,"open_issues_count":4,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T00:00:38.496Z","etag":null,"topics":["level","leveldb","multileveldown","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Level.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-17T12:21:18.000Z","updated_at":"2024-07-23T22:32:30.000Z","dependencies_parsed_at":"2023-02-17T11:30:48.436Z","dependency_job_id":null,"html_url":"https://github.com/Level/party","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fparty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fparty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fparty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fparty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/party/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223296026,"owners_count":17121923,"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":["level","leveldb","multileveldown","nodejs"],"created_at":"2024-08-01T22:01:36.052Z","updated_at":"2025-04-17T13:31:51.707Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","readme":"# level-party\n\n**Superseded by [`rave-level`](https://github.com/Level/rave-level). Please see [Frequently Asked Questions](https://github.com/Level/community#faq).**\n\n## Example\n\nNormally with [`level`](https://npmjs.org/package/level), when you try to open\na database handle from more than one process you will get a locking error:\n\n```\nevents.js:72\n        throw er; // Unhandled 'error' event\n              ^\nOpenError: IO error: lock /home/substack/projects/level-party/example/data/LOCK: Resource temporarily unavailable\n    at /home/substack/projects/level-party/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:114:34\n```\n\nWith `level-party`, the database open will automatically drop down to using\nmultilevel over a unix socket using metadata placed into the level data\ndirectory transparently.\n\nThis means that if you have 2 programs, 1 that gets:\n\n```js\nconst level = require('level-party')\nconst db = level(__dirname + '/data', { valueEncoding: 'json' })\n\nsetInterval(function () {\n  db.get('a', function (err, value) {\n    console.log('a=', value)\n  })\n}, 250)\n```\n\nAnd 1 that puts:\n\n```js\nconst level = require('level-party')\nconst db = level(__dirname + '/data', { valueEncoding: 'json' })\n\nconst n = Math.floor(Math.random() * 100000)\n\nsetInterval(function () {\n  db.put('a', n + 1)\n}, 1000)\n```\n\nand you start them up in any order, everything will just work! No more\n`IO error: lock` exceptions.\n\n```\n$ node put.js \u0026 sleep 0.2; node put.js \u0026 sleep 0.2; node put.js \u0026 sleep 0.2; node put.js \u0026 sleep 0.2\n[1] 3498\n[2] 3502\n[3] 3509\n[4] 3513\n$ node get.js\na= 35340\na= 31575\na= 37639\na= 58874\na= 35341\na= 31576\n$ node get.js\na= 35344\na= 31579\na= 37643\na= 58878\na= 35345\n^C\n```\n\nHooray!\n\n## Seamless failover\n\nlevel-party does seamless failover. This means that if you create a read-stream\nand the leader goes down while you are reading that stream level-party will resume your stream on the new leader.\n\n[**This disables leveldb snapshotting**](https://github.com/level/leveldown#snapshots) so if your app relies on this you should disable this by setting `opts.retry = false`:\n\n```js\nconst db = level('./data', { retry: false }) // will not retry streams / gets / puts if the leader goes down\n```\n\n## Windows support\n\n`level-party` works on Windows as well using named pipes.\n\n## API\n\n### `db = level(...)`\n\nThe arguments are exactly the same as [`level`](https://npmjs.org/package/level). You will sometimes get a real leveldb handle and sometimes get a `multileveldown` handle back in the response.\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install level-party\n```\n\n## Contributing\n\n[`Level/party`](https://github.com/Level/party) is an **OPEN Open Source Project**. This means that:\n\n\u003e Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.\n\n## Donate\n\nSupport us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.\n\n## License\n\n[MIT](LICENSE)\n","funding_links":["https://opencollective.com/level"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLevel%2Fparty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLevel%2Fparty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLevel%2Fparty/lists"}