{"id":31844692,"url":"https://github.com/level/read-stream","last_synced_at":"2025-10-12T07:47:12.952Z","repository":{"id":40577080,"uuid":"437125561","full_name":"Level/read-stream","owner":"Level","description":"Read from an abstract-level database using Node.js streams.","archived":false,"fork":false,"pushed_at":"2025-10-01T07:53:56.000Z","size":111,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-10-01T09:35:39.098Z","etag":null,"topics":["level","nodejs","streams"],"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"level"}},"created_at":"2021-12-10T22:02:58.000Z","updated_at":"2025-10-01T07:53:59.000Z","dependencies_parsed_at":"2023-02-17T00:05:25.239Z","dependency_job_id":"5a471883-9b30-4e84-bfcc-9b8a93f6d2f3","html_url":"https://github.com/Level/read-stream","commit_stats":{"total_commits":117,"total_committers":8,"mean_commits":14.625,"dds":0.6324786324786325,"last_synced_commit":"b48b707a5b8acbcaad8ffa7272a0ad1f4f796ca2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Level/read-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fread-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fread-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fread-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fread-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/read-stream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fread-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010674,"owners_count":26084785,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["level","nodejs","streams"],"created_at":"2025-10-12T07:47:05.540Z","updated_at":"2025-10-12T07:47:12.947Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","funding_links":["https://opencollective.com/level"],"categories":[],"sub_categories":[],"readme":"# level-read-stream\n\n**Read from an [`abstract-level`](https://github.com/Level/abstract-level) database using Node.js streams.**\n\n\u003e :pushpin: To instead consume data using Web Streams, see [`level-web-stream`](https://github.com/Level/web-stream).\n\n[![level badge][level-badge]](https://github.com/Level/awesome)\n[![npm](https://img.shields.io/npm/v/level-read-stream.svg)](https://www.npmjs.com/package/level-read-stream)\n[![Node version](https://img.shields.io/node/v/level-read-stream.svg)](https://www.npmjs.com/package/level-read-stream)\n[![Test](https://img.shields.io/github/actions/workflow/status/Level/read-stream/test.yml?branch=main\\\u0026label=test)](https://github.com/Level/read-stream/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/read-stream?label=\u0026logo=codecov\u0026logoColor=fff)](https://codecov.io/gh/Level/read-stream)\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[![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 migrating from `levelup` or `level \u003c= 7`: please see [UPGRADING.md](UPGRADING.md)._\n\n```js\nconst { EntryStream } = require('level-read-stream')\nconst { Writable, pipeline } = require('readable-stream')\n\nawait db.put('a', '1')\nawait db.put('b', '2')\nawait db.put('c', '3')\n\nconst src = new EntryStream(db, {\n  gte: 'b'\n})\n\nconst dst = new Writable({\n  write (entry, _, next) {\n    console.log('%s: %s', entry.key, entry.value)\n    next()\n  }\n})\n\npipeline(src, dst)\n```\n\nYields:\n\n```\nb: 2\nc: 3\n```\n\nTo only read keys or values rather than entries:\n\n```js\nconst { KeyStream, ValueStream } = require('level-read-stream')\n\npipeline(new KeyStream(db), new Writable({\n  write (key, _, next) {\n    console.log(key)\n    next()\n  }\n}))\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install level-read-stream\n```\n\nUsage from TypeScript also requires `npm install @types/readable-stream`.\n\n## API\n\n### `stream = new EntryStream(db[, options])`\n\nCreate a readable stream that will yield entries. An entry is an object with `key` and `value` properties. The `db` argument must be an `abstract-level` database. The optional `options` object may contain:\n\n- `highWaterMark` (number): the maximum number of entries to buffer internally before ceasing to read further entries. Default 1000.\n\nAny other options are forwarded to `db.iterator(options)`. The stream wraps that iterator. If you prefer to consume entries with `for await...of` then it's recommended to directly use `db.iterator()`. In either case, most databases will read from a snapshot (thus unaffected by simultaneous writes) as indicated by `db.supports.snapshots`.\n\nUpon stream end or having called `stream.destroy()` the underlying iterator will be closed after which a `close` event is emitted on the stream.\n\n### `stream = new KeyStream(db[, options])`\n\nSame as `EntryStream` but yields keys instead of entries, using `db.keys()` instead of `db.iterator()`. If only keys are needed, using `KeyStream` may increase performance because values won't have to be fetched.\n\n### `stream = new ValueStream(db[, options])`\n\nSame as `EntryStream` but yields values instead of entries, using `db.values()` instead of `db.iterator()`. If only values are needed, using `ValueStream` may increase performance because keys won't have to be fetched.\n\n### `stream`\n\nAn instance of `EntryStream`, `KeyStream` or `ValueStream` has the following special properties.\n\n#### `stream.db`\n\nA read-only reference to the database that this stream is reading from.\n\n## Contributing\n\n[`Level/read-stream`](https://github.com/Level/read-stream) 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Fread-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevel%2Fread-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Fread-stream/lists"}