{"id":14384738,"url":"https://github.com/Level/memdown","last_synced_at":"2025-08-23T17:33:30.262Z","repository":{"id":7499227,"uuid":"8848815","full_name":"Level/memdown","owner":"Level","description":"In-memory abstract-leveldown store for Node.js and browsers.","archived":false,"fork":false,"pushed_at":"2023-04-10T14:43:04.000Z","size":244,"stargazers_count":287,"open_issues_count":1,"forks_count":37,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-30T00:00:37.272Z","etag":null,"topics":["abstract-leveldown","browser","javascript","level","leveldown","levelup","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},"funding":{"open_collective":"level"}},"created_at":"2013-03-18T07:03:15.000Z","updated_at":"2024-10-21T08:39:31.000Z","dependencies_parsed_at":"2023-10-11T09:12:06.114Z","dependency_job_id":null,"html_url":"https://github.com/Level/memdown","commit_stats":{"total_commits":303,"total_committers":26,"mean_commits":"11.653846153846153","dds":0.6303630363036303,"last_synced_commit":"2d4b09c567f6f128b3f9896a9bebe0b8777e0a29"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fmemdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fmemdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fmemdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fmemdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/memdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230688751,"owners_count":18265262,"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-leveldown","browser","javascript","level","leveldown","levelup","nodejs"],"created_at":"2024-08-28T18:01:37.629Z","updated_at":"2025-08-23T17:33:30.247Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","readme":"# memdown\n\n**Superseded by [`memory-level`](https://github.com/Level/memory-level). Please see [Frequently Asked Questions](https://github.com/Level/community#faq).**\n\n## Example\n\n_If you are upgrading: please see [`UPGRADING.md`](./UPGRADING.md)._\n\n```js\nconst levelup = require('levelup')\nconst memdown = require('memdown')\n\nconst db = levelup(memdown())\n\ndb.put('hey', 'you', (err) =\u003e {\n  if (err) throw err\n\n  db.get('hey', { asBuffer: false }, (err, value) =\u003e {\n    if (err) throw err\n    console.log(value) // 'you'\n  })\n})\n```\n\nWith `async/await`:\n\n```js\nawait db.put('hey', 'you')\nconst value = await db.get('hey', { asBuffer: false })\n```\n\nYour data is discarded when the process ends or you release a reference to the store. Note as well, though the internals of `memdown` operate synchronously - [`levelup`] does not.\n\n## Browser support\n\n[![Sauce Test Status](https://app.saucelabs.com/browser-matrix/level-ci.svg)](https://app.saucelabs.com/u/level-ci)\n\n## Data types\n\nKeys and values can be strings or Buffers. Any other key type will be irreversibly stringified. The only exceptions are `null` and `undefined`. Keys and values of that type are rejected.\n\n```js\nconst db = levelup(memdown())\n\ndb.put('example', 123, (err) =\u003e {\n  if (err) throw err\n\n  db.createReadStream({\n    keyAsBuffer: false,\n    valueAsBuffer: false\n  }).on('data', (entry) =\u003e {\n    console.log(typeof entry.key) // 'string'\n    console.log(typeof entry.value) // 'string'\n  })\n})\n```\n\nIf you desire non-destructive encoding (e.g. to store and retrieve numbers as-is), wrap `memdown` with [`encoding-down`]. Alternatively install [`level-mem`] which conveniently bundles [`levelup`], `memdown` and [`encoding-down`]. Such an approach is also recommended if you want to achieve universal (isomorphic) behavior. For example, you could have [`leveldown`] in a backend and `memdown` in the frontend.\n\n```js\nconst encode = require('encoding-down')\nconst db = levelup(encode(memdown(), { valueEncoding: 'json' }))\n\ndb.put('example', 123, (err) =\u003e {\n  if (err) throw err\n\n  db.createReadStream({\n    keyAsBuffer: false,\n    valueAsBuffer: false\n  }).on('data', (entry) =\u003e {\n    console.log(typeof entry.key) // 'string'\n    console.log(typeof entry.value) // 'number'\n  })\n})\n```\n\n## Snapshot guarantees\n\nA `memdown` store is backed by [a fully persistent data structure](https://www.npmjs.com/package/functional-red-black-tree) and thus has snapshot guarantees. Meaning that reads operate on a snapshot in time, unaffected by simultaneous writes.\n\n## Test\n\nIn addition to the regular `npm test`, you can test `memdown` in a browser of choice with:\n\n```\nnpm run test-browser-local\n```\n\nTo check code coverage:\n\n```\nnpm run coverage\n```\n\n## Contributing\n\n[`Level/memdown`](https://github.com/Level/memdown) 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## Big Thanks\n\nCross-browser Testing Platform and Open Source ♥ Provided by [Sauce Labs](https://saucelabs.com).\n\n[![Sauce Labs logo](./sauce-labs.svg)](https://saucelabs.com)\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[`abstract-leveldown`]: https://github.com/Level/abstract-leveldown\n\n[`levelup`]: https://github.com/Level/levelup\n\n[`encoding-down`]: https://github.com/Level/encoding-down\n\n[`leveldown`]: https://github.com/Level/leveldown\n\n[`level-mem`]: https://github.com/Level/mem\n\n[level-badge]: https://leveljs.org/img/badge.svg\n","funding_links":["https://opencollective.com/level"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLevel%2Fmemdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLevel%2Fmemdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLevel%2Fmemdown/lists"}