{"id":17398480,"url":"https://github.com/vweevers/level-probe","last_synced_at":"2025-06-22T19:08:56.178Z","repository":{"id":66220551,"uuid":"51151332","full_name":"vweevers/level-probe","owner":"vweevers","description":"Get the first result in a range, using an iterator or stream","archived":false,"fork":false,"pushed_at":"2016-02-07T03:03:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T19:08:52.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/vweevers.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-05T14:30:24.000Z","updated_at":"2016-02-05T15:44:14.000Z","dependencies_parsed_at":"2023-04-28T12:23:56.109Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/level-probe","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"51c26bdd8088693ee48f9c8a22ffd6ebee1a788e"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/level-probe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Flevel-probe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Flevel-probe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Flevel-probe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Flevel-probe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/level-probe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Flevel-probe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261348755,"owners_count":23145314,"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":[],"created_at":"2024-10-16T14:57:14.130Z","updated_at":"2025-06-22T19:08:56.131Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# level-probe\r\n\r\n**Get the first result in a range, using an [iterator](https://github.com/vweevers/level-iterator) or stream.**\r\n\r\n[![npm status](http://img.shields.io/npm/v/level-probe.svg?style=flat-square)](https://www.npmjs.org/package/level-probe) [![Travis build status](https://img.shields.io/travis/vweevers/level-probe.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/level-probe) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/level-probe.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/level-probe) [![Dependency status](https://img.shields.io/david/vweevers/level-probe.svg?style=flat-square)](https://david-dm.org/vweevers/level-probe)\r\n\r\n## example\r\n\r\n```js\r\nconst probe = require('level-probe')\r\nconst disk = require('test-level')({ clean: true })\r\n\r\nconst db = disk()\r\n\r\ndb.batch([\r\n  { key: 'a', value: 'value a' },\r\n  { key: 'b', value: 'value b' },\r\n  { key: 'c', value: 'value c' }\r\n], function(err) {\r\n  probe(db, { gte: 'b' }, function(err, kv){\r\n    console.log(kv)\r\n  })\r\n\r\n  probe.value(db, { lt: 'x', reverse: true }, function(err, val){\r\n    console.log(val)\r\n  })\r\n\r\n  probe(db, { gt: 'd', lt: 'x' }, function(err){\r\n    console.log(err.message)\r\n    console.log(err.notFound)\r\n  })\r\n})\r\n```\r\n\r\nOutput:\r\n\r\n```\r\n{ key: 'b', value: 'value b' }\r\nvalue c\r\nNo result in range { gt: \"d\", lt: \"x\" }\r\ntrue\r\n```\r\n\r\n## `probe(db, [opts], callback)`\r\n\r\n- If `opts.iterate` is `false`, `level-probe` will use a stream. If `true`, it will use an iterator or throw if iterators are not available. If not specified, it will prefer iterators and fall back to streams.\r\n- Other options are passed to [level-iterator](https://github.com/vweevers/level-iterator) or `db.createReadStream()`\r\n\r\n## `probe.key(db, [opts], callback)`\r\n\r\nShortcut to `probe(db, { values: false }, callback)`.\r\n\r\n## `probe.value(db, [opts], callback)`\r\n\r\nShortcut to `probe(db, { keys: false }, callback)`.\r\n\r\n## install\r\n\r\nWith [npm](https://npmjs.org) do:\r\n\r\n```\r\nnpm install level-probe\r\n```\r\n\r\n## license\r\n\r\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Flevel-probe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Flevel-probe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Flevel-probe/lists"}