{"name":"memory-level","version":"3.0.0","keywords":["level","leveldb","leveldown","levelup","memory"],"author":{"url":"https://github.com/rvagg","name":"Rod Vagg","email":"rod@vagg.org"},"license":"MIT","_id":"memory-level@3.0.0","maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"homepage":"https://github.com/Level/memory-level","bugs":{"url":"https://github.com/Level/memory-level/issues"},"dist":{"shasum":"d8d597d1e0910bedf37604398c7a63eba909009d","tarball":"http://registry-npm.ywwl.com/memory-level/download/memory-level-3.0.0.tgz","fileCount":11,"integrity":"sha512-2g/DdA+vrazyAaofQNSD4yFiNen4K3C4/8dKiSiacbO0tuoRdUQwzc7GvHEVnWlzt2Lwdz5wgk8vGKJp67/Cwg==","signatures":[{"sig":"MEUCIEYW7FFHa2bxAsxZtDTNeSIH4PsuDSX5u5Ts41/ROy/cAiEApbl+tJr4KSJcFyETYqAGB1wBlafS+sVx8MKR5MnO3Gg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27357,"size":8225,"noattachment":false,"key":"/memory-level/-/memory-level-3.0.0.tgz"},"main":"index.js","types":"./index.d.ts","engines":{"node":">=18"},"gitHead":"6eac9e968463fd3f01e6e1f0852fa8178c729cce","scripts":{"test":"standard && hallmark && (nyc -s node test.js | tap-arc) && nyc report","coverage":"nyc report -r lcovonly","test-browsers":"airtap --coverage test.js","test-pessimistic":"node test.js | tap-arc -pv"},"_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"repository":{"url":"git+https://github.com/Level/memory-level.git","type":"git"},"_npmVersion":"10.8.2","description":"In-memory abstract-level database for Node.js and browsers","directories":{},"_nodeVersion":"22.7.0","dependencies":{"module-error":"^1.0.1","abstract-level":"^3.0.1","functional-red-black-tree":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.1.0","tape":"^5.0.1","airtap":"^5.0.0","buffer":"^6.0.3","tap-arc":"^1.3.2","babelify":"^10.0.0","hallmark":"^5.0.1","standard":"^17.0.0","typescript":"^5.6.3","@babel/preset-env":"^7.26.0","airtap-playwright":"^1.0.1","@voxpelli/tsconfig":"^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/memory-level_3.0.0_1737907755097_0.23055321855150201","host":"s3://npm-registry-packages-npm-production"},"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","publish_time":1737907755325,"_cnpm_publish_time":1737907755325,"dist-tags":{"latest":"3.1.0"}}