{"_id":"memory-level","_rev":"4659836","name":"memory-level","description":"In-memory abstract-level database for Node.js and browsers","dist-tags":{"latest":"3.1.0"},"maintainers":[{"name":"vweevers","email":""}],"time":{"modified":"2026-04-10T21:51:44.000Z","created":"2022-01-30T21:40:23.732Z","3.1.0":"2025-04-20T14:11:36.992Z","3.0.0":"2025-01-26T16:09:15.325Z","2.0.0":"2024-10-21T22:27:16.050Z","1.0.0":"2022-01-30T21:40:23.732Z"},"users":{},"author":{"name":"Rod Vagg","email":"rod@vagg.org","url":"https://github.com/rvagg"},"repository":{"type":"git","url":"git+https://github.com/Level/memory-level.git"},"versions":{"3.1.0":{"name":"memory-level","version":"3.1.0","description":"In-memory abstract-level database for Node.js and browsers","author":{"name":"Rod Vagg","email":"rod@vagg.org","url":"https://github.com/rvagg"},"license":"MIT","main":"index.js","types":"./index.d.ts","scripts":{"test":"standard && hallmark && (nyc -s node test.js | tap-arc) && nyc report","test-pessimistic":"node test.js | tap-arc -pv","test-browsers":"airtap --coverage test.js","coverage":"nyc report -r lcovonly"},"dependencies":{"abstract-level":"^3.1.0","functional-red-black-tree":"^1.0.1","module-error":"^1.0.1"},"devDependencies":{"@babel/preset-env":"^7.26.9","@voxpelli/tsconfig":"^15.1.2","airtap":"^5.0.0","airtap-playwright":"^1.0.1","babelify":"^10.0.0","buffer":"^6.0.3","hallmark":"^5.0.1","nyc":"^17.1.0","standard":"^17.0.0","tap-arc":"^1.3.2","tape":"^5.0.1","typescript":"^5.8.3"},"repository":{"type":"git","url":"git+https://github.com/Level/memory-level.git"},"homepage":"https://github.com/Level/memory-level","keywords":["level","leveldb","leveldown","levelup","memory"],"engines":{"node":">=18"},"_id":"memory-level@3.1.0","gitHead":"4b555c625f79a4f1f10ebcf4405f56e352590309","bugs":{"url":"https://github.com/Level/memory-level/issues"},"_nodeVersion":"22.7.0","_npmVersion":"10.8.2","dist":{"shasum":"76d971f50072e3408ca7aacf3e97eeddea293517","size":8305,"noattachment":false,"key":"/memory-level/-/memory-level-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/memory-level/download/memory-level-3.1.0.tgz"},"_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"directories":{},"maintainers":[{"name":"vweevers","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memory-level_3.1.0_1745158296816_0.5810186579702328"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-04-20T14:11:36.992Z","publish_time":1745158296992,"_source_registry_name":"default","_cnpm_publish_time":1745158296992},"3.0.0":{"name":"memory-level","version":"3.0.0","description":"In-memory abstract-level database for Node.js and browsers","author":{"name":"Rod Vagg","email":"rod@vagg.org","url":"https://github.com/rvagg"},"license":"MIT","main":"index.js","types":"./index.d.ts","scripts":{"test":"standard && hallmark && (nyc -s node test.js | tap-arc) && nyc report","test-pessimistic":"node test.js | tap-arc -pv","test-browsers":"airtap --coverage test.js","coverage":"nyc report -r lcovonly"},"dependencies":{"abstract-level":"^3.0.1","functional-red-black-tree":"^1.0.1","module-error":"^1.0.1"},"devDependencies":{"@babel/preset-env":"^7.26.0","@voxpelli/tsconfig":"^15.0.0","airtap":"^5.0.0","airtap-playwright":"^1.0.1","babelify":"^10.0.0","buffer":"^6.0.3","hallmark":"^5.0.1","nyc":"^17.1.0","standard":"^17.0.0","tap-arc":"^1.3.2","tape":"^5.0.1","typescript":"^5.6.3"},"repository":{"type":"git","url":"git+https://github.com/Level/memory-level.git"},"homepage":"https://github.com/Level/memory-level","keywords":["level","leveldb","leveldown","levelup","memory"],"engines":{"node":">=18"},"_id":"memory-level@3.0.0","gitHead":"6eac9e968463fd3f01e6e1f0852fa8178c729cce","bugs":{"url":"https://github.com/Level/memory-level/issues"},"_nodeVersion":"22.7.0","_npmVersion":"10.8.2","dist":{"shasum":"d8d597d1e0910bedf37604398c7a63eba909009d","size":8225,"noattachment":false,"key":"/memory-level/-/memory-level-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/memory-level/download/memory-level-3.0.0.tgz"},"_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"directories":{},"maintainers":[{"name":"vweevers","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memory-level_3.0.0_1737907755097_0.23055321855150201"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-01-26T16:09:15.325Z","publish_time":1737907755325,"_source_registry_name":"default","_cnpm_publish_time":1737907755325},"2.0.0":{"name":"memory-level","version":"2.0.0","description":"In-memory abstract-level database for Node.js and browsers","author":{"name":"Rod Vagg","email":"rod@vagg.org","url":"https://github.com/rvagg"},"license":"MIT","main":"index.js","types":"./index.d.ts","scripts":{"test":"standard && hallmark && (nyc -s node test.js | tap-arc) && nyc report","test-pessimistic":"node test.js | tap-arc -pv","test-browsers":"airtap --coverage --verbose test.js","test-browsers-local":"airtap --coverage -p local test.js","coverage":"nyc report -r lcovonly"},"dependencies":{"abstract-level":"^2.0.1","functional-red-black-tree":"^1.0.1","module-error":"^1.0.1"},"devDependencies":{"@voxpelli/tsconfig":"^15.0.0","airtap":"^4.0.3","airtap-playwright":"^1.0.1","airtap-sauce":"^1.1.0","buffer":"^6.0.3","hallmark":"^5.0.1","nyc":"^17.1.0","standard":"^17.0.0","tap-arc":"^1.3.2","tape":"^5.0.1","typescript":"^5.6.3"},"repository":{"type":"git","url":"git+https://github.com/Level/memory-level.git"},"homepage":"https://github.com/Level/memory-level","keywords":["level","leveldb","leveldown","levelup","memory"],"engines":{"node":">=18"},"_id":"memory-level@2.0.0","gitHead":"dff10fa8624e21a39dfcad31cefa2735cffc1746","bugs":{"url":"https://github.com/Level/memory-level/issues"},"_nodeVersion":"22.7.0","_npmVersion":"10.8.2","dist":{"shasum":"d31910ea201fb6bdcc971e2737987c5a14116ad2","size":7580,"noattachment":false,"key":"/memory-level/-/memory-level-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/memory-level/download/memory-level-2.0.0.tgz"},"_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"directories":{},"maintainers":[{"name":"vweevers","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/memory-level_2.0.0_1729549635795_0.13040961106474414"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-10-21T22:27:16.050Z","publish_time":1729549636050,"_source_registry_name":"default","_cnpm_publish_time":1729549636050},"1.0.0":{"name":"memory-level","version":"1.0.0","description":"In-memory abstract-level database for Node.js and browsers","author":{"name":"Rod Vagg","email":"rod@vagg.org","url":"https://github.com/rvagg"},"license":"MIT","main":"index.js","types":"./index.d.ts","scripts":{"test":"standard && ts-standard *.ts && hallmark && (nyc -s node test.js | faucet) && nyc report","test-browsers":"airtap --coverage --verbose test.js","test-browsers-local":"airtap --coverage -p local test.js","coverage":"nyc report -r lcovonly"},"dependencies":{"abstract-level":"^1.0.0","functional-red-black-tree":"^1.0.1","module-error":"^1.0.1"},"devDependencies":{"@voxpelli/tsconfig":"^3.1.0","airtap":"^4.0.3","airtap-playwright":"^1.0.1","airtap-sauce":"^1.1.0","buffer":"^6.0.3","faucet":"^0.0.1","hallmark":"^4.0.0","nyc":"^15.1.0","standard":"^16.0.3","tape":"^5.0.1","ts-standard":"^11.0.0","typescript":"^4.5.5"},"repository":{"type":"git","url":"git+https://github.com/Level/memory-level.git"},"homepage":"https://github.com/Level/memory-level","keywords":["level","leveldb","leveldown","levelup","memory"],"engines":{"node":">=12"},"gitHead":"16aae241a8d99a8e9e70d40f79e277ddb09a0445","bugs":{"url":"https://github.com/Level/memory-level/issues"},"_id":"memory-level@1.0.0","_nodeVersion":"16.9.1","_npmVersion":"7.21.1","dist":{"shasum":"7323c3fd368f9af2f71c3cd76ba403a17ac41692","size":7551,"noattachment":false,"key":"/memory-level/-/memory-level-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/memory-level/download/memory-level-1.0.0.tgz"},"_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"directories":{},"maintainers":[{"name":"vweevers","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/memory-level_1.0.0_1643578823614_0.08023390210998649"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-30T21:40:35.826Z","publish_time":1643578823732,"_cnpm_publish_time":1643578823732}},"readme":"# memory-level\n\n**In-memory [`abstract-level`][abstract-level] database for Node.js and browsers, backed by a [fully persistent red-black tree](https://www.npmjs.com/package/functional-red-black-tree).** The successor to [`memdown`](https://github.com/Level/memdown) and [`level-mem`](https://github.com/Level/mem).\n\n> :pushpin: Wondering what happened to `levelup`? Visit [Frequently Asked Questions](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/memory-level.svg)](https://www.npmjs.com/package/memory-level)\n[![Node version](https://img.shields.io/node/v/memory-level.svg)](https://www.npmjs.com/package/memory-level)\n[![Test](https://img.shields.io/github/actions/workflow/status/Level/memory-level/test.yml?branch=main\\&label=test)](https://github.com/Level/memory-level/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/memory-level?label=&logo=codecov&logoColor=fff)](https://codecov.io/gh/Level/memory-level)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript&logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective&logoColor=fff)](https://opencollective.com/level)\n\n## Usage\n\n_If you are upgrading: please see [`UPGRADING.md`](./UPGRADING.md)._\n\n```js\nconst { MemoryLevel } = require('memory-level')\n\n// Create a database\nconst db = new MemoryLevel({ 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\n## API\n\nThe API of `memory-level` follows that of [`abstract-level`](https://github.com/Level/abstract-level) with one additional constructor option (see below). The `createIfMissing` and `errorIfExists` options of `abstract-level` are not relevant here. Both implicit and explicit snapshots are supported. Data is discarded when the last reference to the database is released (i.e. `db = null`). Closing or reopening the database has no effect on the data. Data is _not_ copied: when storing a Buffer value for example, subsequent mutations to that Buffer will affect the stored data too.\n\n### `db = new MemoryLevel([options])`\n\nBesides `abstract-level` options, the optional `options` object may contain:\n\n- `storeEncoding` (string): one of `'buffer'`, `'view'`, `'utf8'`. How to store data internally. This affects which data types can be stored non-destructively. The default is `'buffer'` (that means Buffer) which is non-destructive. In browsers it may be preferable to use `'view'` (Uint8Array) to be able to exclude the [`buffer`](https://github.com/feross/buffer) shim. Or if there's no need to store binary data, then `'utf8'` (String). Regardless of the `storeEncoding`, `memory-level` supports input that is of any of the aforementioned types, but internally converts it to one type in order to provide a consistent sort order.\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install memory-level\n```\n\n## Contributing\n\n[`Level/memory-level`](https://github.com/Level/memory-level) is an **OPEN Open Source Project**. This means that:\n\n> 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## License\n\n[MIT](LICENSE)\n\n[abstract-level]: https://github.com/Level/abstract-level\n\n[level-badge]: https://leveljs.org/img/badge.svg\n","_attachments":{},"homepage":"https://github.com/Level/memory-level","bugs":{"url":"https://github.com/Level/memory-level/issues"},"license":"MIT"}