{"id":13836114,"url":"https://github.com/fastify/fastify-leveldb","last_synced_at":"2025-04-09T20:06:28.048Z","repository":{"id":22556283,"uuid":"96675654","full_name":"fastify/fastify-leveldb","owner":"fastify","description":"Plugin to share a common LevelDB connection across Fastify","archived":false,"fork":false,"pushed_at":"2025-04-06T06:07:32.000Z","size":124,"stargazers_count":26,"open_issues_count":0,"forks_count":10,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-09T20:06:20.237Z","etag":null,"topics":["fastify","fastify-plugin"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@fastify/leveldb","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/fastify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fastify","open_collective":"fastify"}},"created_at":"2017-07-09T09:59:34.000Z","updated_at":"2025-04-06T06:07:35.000Z","dependencies_parsed_at":"2023-01-11T21:40:32.426Z","dependency_job_id":"21e08321-5511-4c8c-bb1b-528fc9ad8ca9","html_url":"https://github.com/fastify/fastify-leveldb","commit_stats":{"total_commits":142,"total_committers":21,"mean_commits":6.761904761904762,"dds":0.6549295774647887,"last_synced_commit":"0de570f788e4654aee96654561b3b95a5e29e2f1"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-leveldb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-leveldb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-leveldb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-leveldb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastify","download_url":"https://codeload.github.com/fastify/fastify-leveldb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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":["fastify","fastify-plugin"],"created_at":"2024-08-04T15:00:35.862Z","updated_at":"2025-04-09T20:06:28.028Z","avatar_url":"https://github.com/fastify.png","language":"JavaScript","readme":"# @fastify/leveldb\n\n[![CI](https://github.com/fastify/fastify-leveldb/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-leveldb/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/@fastify/leveldb.svg?style=flat)](https://www.npmjs.com/package/@fastify/leveldb)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)\n\n\nFastify LevelDB connection plugin, with this you can share the same Level connection in every part of your server.\n\nUnder the hood [Levelup](https://github.com/Level/levelup) is used, the options that you pass to register will be passed to Levelup.\n\n## Install\n```\nnpm i @fastify/leveldb\n```\n\n### Compatibility\n| Plugin version | Fastify version |\n| ---------------|-----------------|\n| `\u003e=6.x`        | `^5.x`          |\n| `^5.x`         | `^4.x`          |\n| `\u003e=3.x \u003c5.x`   | `^3.x`          |\n| `^0.x \u003c3.x`    | `^2.x`          |\n| `^0.x \u003c3.x`    | `^1.x`          |\n\nPlease note that if a Fastify version is out of support, then so are the corresponding versions of this plugin\nin the table above.\nSee [Fastify's LTS policy](https://github.com/fastify/fastify/blob/main/docs/Reference/LTS.md) for more details.\n\n## Usage\nAdd it to you project with `register`, configure the database name and you are done!\n\nYou can access LevelDB via `fastify.level[name]`.\n```js\nconst fastify = require('fastify')()\n\nfastify.register(\n  require('@fastify/leveldb'),\n  { name: 'db' }\n)\n\nfastify.get('/foo', async function (req, reply) {\n  const val = await this.level.db.get(req.query.key)\n  return val\n})\n\nfastify.post('/foo', async function (req, reply) {\n  await this.level.db.put(req.body.key, req.body.value)\n  return { status: 'ok' }\n})\n\nfastify.listen({ port: 3000 }, err =\u003e {\n  if (err) throw err\n  console.log(`server listening on ${fastify.server.address().port}`)\n})\n```\n\nBy default, [Leveldown](https://github.com/Level/leveldown) is used for the store but you can use any [Abstact-leveldown](https://github.com/Level/abstract-leveldown/) compliant store, such as [memdown](https://github.com/Level/memdown).\n\nFirst, you must install the store:\n\n```sh\nnpm i memdown\n```\n\nNext, initialize the plugin with the given store:\n\n```js\nfastify.register(require('@fastify/leveldb'), {\n  name: 'db',\n  options: {\n    store: require('memdown')\n  }\n})\n```\n\nBy default the path where the db will be created is the name option, but you can also pass a custom path as well.\n```js\nfastify.register(\n  require('@fastify/leveldb'),\n  { name: 'db', path: '.local' }\n)\n```\n\n## Acknowledgments\n\nThis project is kindly sponsored by:\n- [nearForm](https://nearform.com)\n- [LetzDoIt](https://www.letzdoitapp.com/)\n\n## License\n\nLicensed under [MIT](./LICENSE).\n","funding_links":["https://github.com/sponsors/fastify","https://opencollective.com/fastify"],"categories":["\u003ch2 align=\"center\"\u003eAwesome Fastify\u003c/h2\u003e"],"sub_categories":["\u003ch2 align=\"center\"\u003eEcosystem\u003c/h2\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-leveldb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastify%2Ffastify-leveldb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-leveldb/lists"}