{"id":17315348,"url":"https://github.com/frando/subhyperdb","last_synced_at":"2025-07-28T07:07:10.113Z","repository":{"id":57373953,"uuid":"126500692","full_name":"Frando/subhyperdb","owner":"Frando","description":"Namespace a hyperdb into prefixed sections that may have different valueEncodings.","archived":false,"fork":false,"pushed_at":"2018-03-23T19:08:01.000Z","size":55,"stargazers_count":32,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-22T15:08:07.200Z","etag":null,"topics":["hyperdb"],"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/Frando.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":"2018-03-23T15:00:09.000Z","updated_at":"2020-05-19T03:18:24.000Z","dependencies_parsed_at":"2022-09-17T16:00:56.561Z","dependency_job_id":null,"html_url":"https://github.com/Frando/subhyperdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Frando/subhyperdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fsubhyperdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fsubhyperdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fsubhyperdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fsubhyperdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frando","download_url":"https://codeload.github.com/Frando/subhyperdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fsubhyperdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267475897,"owners_count":24093379,"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-07-28T02:00:09.689Z","response_time":68,"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":["hyperdb"],"created_at":"2024-10-15T13:07:45.636Z","updated_at":"2025-07-28T07:07:10.067Z","avatar_url":"https://github.com/Frando.png","language":"JavaScript","readme":"# SubHyperDB\n\nSplit a [HyperDB](https://github.com/mafintosh/hyperdb) into namespaces or sections. Each SubHyperDB may have a different value encoding.\n\n## Usage\n\n``` js\nvar hyperdb = require('hyperdb')\nvar sub = require('subhyperdb')\n\nvar db = hyperdb('./db', {valueEncoding: 'binary'})\n\nvar sub1 = sub(db, 'sub1', {valueEncoding: 'utf8'})\nvar sub2 = sub(db, {valueEncoding: 'json'})\n\nsub1.put('hello', 'world', function() {\n  sub2.put('hello', {where: 'moon'}, function() {\n    sub1.get('hello', function(err, node) {\n      console.log('sub1: ' + node.value) // world\n    })\n    sub2.get('hello', function(err, node) {\n      console.log('sub2: ' + JSON.stringify(node.value)) // {where: 'moon'}\n    })\n  })\n})\n\nconsole.log('Prefix for sub1: ' + sub1.prefix) // prefix for sub1 was set manually\nconsole.log('Prefix for sub2: ' + sub2.prefix) // prefix for sub2 was autocreated\n\n```\n\n## API\n\n#### `var subDb = sub(db, [prefix], [opts])`\n\nCreate a new sub database.\n\n`db` has to be a hyperdb instance that was created with a `valueEncoding: 'binary'` option.\n\n`prefix` sets the prefix to be used. If not set, a random prefix will be created.\n\n`opts` So far the only option is `valueEncoding`.\n\nPublic API is a subset of the HyperDB API. Supported methods are:\n\n`get`, `put`, `del`, `batch`, `list`, `createReadStream`, `createWriteStream`, `replicate`\n\nSupport for more methods (e.g. `createDiffStream`, `createHistoryStream`) is TODO.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrando%2Fsubhyperdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrando%2Fsubhyperdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrando%2Fsubhyperdb/lists"}