{"id":14384538,"url":"https://github.com/geut/hypercore-promise","last_synced_at":"2025-04-28T12:28:36.731Z","repository":{"id":88986034,"uuid":"239000684","full_name":"geut/hypercore-promise","owner":"geut","description":"An async/await based wrapper for hypercore","archived":false,"fork":false,"pushed_at":"2020-07-24T19:07:37.000Z","size":41,"stargazers_count":9,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T09:41:17.284Z","etag":null,"topics":["async-await","dat","hypercore","promises"],"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/geut.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2020-02-07T18:50:53.000Z","updated_at":"2023-06-14T20:51:48.000Z","dependencies_parsed_at":"2024-06-21T05:55:32.007Z","dependency_job_id":null,"html_url":"https://github.com/geut/hypercore-promise","commit_stats":{"total_commits":35,"total_committers":3,"mean_commits":"11.666666666666666","dds":0.2571428571428571,"last_synced_commit":"fe36294785e91d01e2618542deecb7788aef4020"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fhypercore-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fhypercore-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fhypercore-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fhypercore-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geut","download_url":"https://codeload.github.com/geut/hypercore-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249428482,"owners_count":21270467,"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":["async-await","dat","hypercore","promises"],"created_at":"2024-08-28T18:01:27.629Z","updated_at":"2025-04-18T04:31:16.953Z","avatar_url":"https://github.com/geut.png","language":"JavaScript","readme":"# hypercore-promise\n\n[![Build Status](https://travis-ci.com/geut/hypercore-promise.svg?branch=master)](https://travis-ci.com/geut/hypercore-promise)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\n\u003e An async/await based wrapper for [hypercore](https://github.com/hypercore-protocol/hypercore) (v9+)\n\n## \u003ca name=\"install\"\u003e\u003c/a\u003e Install\n\n```\n$ npm install @geut/hypercore-promise\n```\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003e Usage\n\n```javascript\nconst hypercore = require('@geut/hypercore-promise')\n\n;(async () =\u003e {\n  const feed = hypercore('./my-first-dataset', {valueEncoding: 'utf-8'})\n\n  await feed.append('hello')\n  await feed.append('world')\n\n  console.log(await feed.get(0)) // prints hello\n  console.log(await feed.get(1)) // prints world\n})\n```\n\n### Differences with Hypercore\n\nSome methods like `get` and `download` not only use callbacks but also returns a value directly.\n\n```javascript\nconst id = feed.get(0, (err, data) =\u003e {\n  console.log(data)\n})\n```\n\nSince our methods return promises what you need to do to get the internal value is to use our function helper `getValue`.\n\n```javascript\nconst { getValue } = require('hypercore-promise')\n\nconst promise = feed.get(0)\nconst id = getValue(promise)\npromise.then(data =\u003e console.log(data))\n```\n\n`hypercore-promise` already detects the internal value so you don't need to use `getValue` in that case.\n\n```javascript\nconst promise = feed.get(0)\nfeed.cancel(promise)\npromise.catch(err =\u003e {\n  console.log('was canceled')\n})\n```\n\n## \u003ca name=\"issues\"\u003e\u003c/a\u003e Issues\n\n:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/hypercore-promise/issues). Please specify your OS and the actions to reproduce it.\n\n## \u003ca name=\"contribute\"\u003e\u003c/a\u003e Contributing\n\n:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/hypercore-promise/blob/master/CONTRIBUTING.md).\n\n## License\n\nMIT © A [**GEUT**](http://geutstudio.com/) project\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fhypercore-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeut%2Fhypercore-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fhypercore-promise/lists"}