{"id":13498630,"url":"https://github.com/level/level","last_synced_at":"2025-05-14T22:06:38.793Z","repository":{"id":8535734,"uuid":"10154685","full_name":"Level/level","owner":"Level","description":"Universal abstract-level database for Node.js and browsers.","archived":false,"fork":false,"pushed_at":"2025-04-28T17:28:38.000Z","size":185,"stargazers_count":1628,"open_issues_count":6,"forks_count":108,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-14T22:06:35.039Z","etag":null,"topics":["abstract-level","browsers","electron","javascript","level","leveldb","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"level"}},"created_at":"2013-05-19T11:33:49.000Z","updated_at":"2025-05-14T02:18:53.000Z","dependencies_parsed_at":"2023-02-16T17:31:09.134Z","dependency_job_id":"4d3fe6f2-eff6-475c-92e9-9be3b34db9e5","html_url":"https://github.com/Level/level","commit_stats":{"total_commits":197,"total_committers":20,"mean_commits":9.85,"dds":0.6446700507614214,"last_synced_commit":"6bf275ed06dc4d87d95f1ca04fca63ee9c75021b"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Flevel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Flevel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Flevel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Flevel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/level/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235695,"owners_count":22036963,"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":["abstract-level","browsers","electron","javascript","level","leveldb","nodejs"],"created_at":"2024-07-31T21:00:38.809Z","updated_at":"2025-05-14T22:06:38.695Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","readme":"# level\n\n**Universal [`abstract-level`](https://github.com/Level/abstract-level) database for Node.js and browsers.** This is a convenience package that exports [`classic-level`](https://github.com/Level/classic-level) in Node.js and [`browser-level`](https://github.com/Level/browser-level) in browsers, making it an ideal entry point to start creating lexicographically sorted key-value databases.\n\n\u003e :pushpin: Which module should I use? What is `abstract-level`? Head over to the [FAQ](https://github.com/Level/community#faq).\n\n[![level badge][level-badge]](https://github.com/Level/awesome)\n[![npm](https://img.shields.io/npm/v/level.svg)](https://www.npmjs.com/package/level)\n[![Node version](https://img.shields.io/node/v/level.svg)](https://www.npmjs.com/package/level)\n[![Test](https://img.shields.io/github/actions/workflow/status/Level/level/test.yml?branch=master\u0026label=test)](https://github.com/Level/level/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/level?label=\\\u0026logo=codecov\\\u0026logoColor=fff)](https://codecov.io/gh/Level/level)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript\\\u0026logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n[![Community](https://img.shields.io/badge/community-join-%2370B99E?logo=github)](https://github.com/Level/community/issues)\n[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective\\\u0026logoColor=fff)](https://opencollective.com/level)\n\n## Usage\n\n_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._\n\n```js\nconst { Level } = require('level')\n\n// Create a database\nconst db = new Level('example', { valueEncoding: 'json' })\n\n// Add an entry with key 'a' and value 1\nawait db.put('a', 1)\n\n// Add multiple entries\nawait db.batch([{ type: 'put', key: 'b', value: 2 }])\n\n// Get value of key 'a': 1\nconst value = await db.get('a')\n\n// Iterate entries with keys that are greater than 'a'\nfor await (const [key, value] of db.iterator({ gt: 'a' })) {\n  console.log(value) // 2\n}\n```\n\nTypeScript type declarations are included and cover the methods that are common between `classic-level` and `browser-level`. Usage from TypeScript requires generic type parameters.\n\n\u003cdetails\u003e\u003csummary\u003eTypeScript example\u003c/summary\u003e\n\n```ts\n// Specify types of keys and values (any, in the case of json).\n// The generic type parameters default to Level\u003cstring, string\u003e.\nconst db = new Level\u003cstring, any\u003e('./db', { valueEncoding: 'json' })\n\n// All relevant methods then use those types\nawait db.put('a', { x: 123 })\n\n// Specify different types when overriding encoding per operation\nawait db.get\u003cstring, string\u003e('a', { valueEncoding: 'utf8' })\n\n// Though in some cases TypeScript can infer them\nawait db.get('a', { valueEncoding: db.valueEncoding('utf8') })\n\n// It works the same for sublevels\nconst abc = db.sublevel('abc')\nconst xyz = db.sublevel\u003cstring, any\u003e('xyz', { valueEncoding: 'json' })\n```\n\n\u003c/details\u003e\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install level\n```\n\nFor use in browsers, this package is best used with [`browserify`](https://github.com/browserify/browserify), [`webpack`](https://webpack.js.org/), [`rollup`](https://rollupjs.org/) or similar bundlers. For a quick start, visit [`browserify-starter`](https://github.com/Level/browserify-starter) or [`webpack-starter`](https://github.com/Level/webpack-starter).\n\n## Supported Platforms\n\nAt the time of writing, `level` works in Node.js 18+ and Electron 30+ on Linux, Mac OS and Windows, including any future Node.js and Electron release thanks to [Node-API](https://nodejs.org/api/n-api.html), including ARM platforms like Raspberry Pi and Android, as well as in Chromium, Firefox and Safari. For details, see [Supported Platforms](https://github.com/Level/classic-level#supported-platforms) of `classic-level` and [Browser Support](https://github.com/Level/browser-level#browser-support) of `browser-level`.\n\nBinary keys and values are supported across the board.\n\n## API\n\nThe API of `level` follows that of [`abstract-level`](https://github.com/Level/abstract-level). For additional options and methods specific to [`classic-level`](https://github.com/Level/classic-level) or [`browser-level`](https://github.com/Level/browser-level), please see their respective READMEs. The documentation below only covers the common constructor.\n\n### `db = new Level(location[, options])`\n\nCreate a new database or open an existing database. The `location` argument must be a directory path (relative or absolute) where LevelDB will store its files, or in browsers, the name of the [`IDBDatabase`](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be opened.\n\n## Contributing\n\n[`Level/level`](https://github.com/Level/level) 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\n[level-badge]: https://leveljs.org/img/badge.svg\n","funding_links":["https://opencollective.com/level"],"categories":["modules"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Flevel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevel%2Flevel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Flevel/lists"}