| … | … | @@ -0,0 +1,62 @@ |
| 1 | # hyper-sync |
| 2 | |
| 3 | Manage and sync bare git repos over Hyperswarm. |
| 4 | |
| 5 | Serve a bare repository on a topic; clone and fetch from it on another machine with no server, |
| 6 | no forwarded port and no account. It shells out to real `git` for the transfer, so the objects |
| 7 | on both ends are ordinary git objects. |
| 8 | |
| 9 | ## Install |
| 10 | |
| 11 | ```sh |
| 12 | npm install hyper-sync |
| 13 | ``` |
| 14 | |
| 15 | ## Usage |
| 16 | |
| 17 | ```js |
| 18 | const HyperSync = require('hyper-sync') |
| 19 | |
| 20 | const sync = new HyperSync('./repos') |
| 21 | await sync.ready() |
| 22 | |
| 23 | await sync.scan() // find bare repos under ./repos |
| 24 | await sync.serve('myrepo') // announce it on its topic |
| 25 | console.log(await sync.info('myrepo')) |
| 26 | |
| 27 | // elsewhere |
| 28 | await sync.addRemote('myrepo', topicHex) |
| 29 | await sync.pull('myrepo') |
| 30 | ``` |
| 31 | |
| 32 | ## API |
| 33 | |
| 34 | #### `new HyperSync(dir, [options])` |
| 35 | |
| 36 | `ReadyResource` over a directory of bare repos. |
| 37 | |
| 38 | #### `await sync.scan()` |
| 39 | |
| 40 | Discover bare repos under the directory. |
| 41 | |
| 42 | #### `await sync.serve(name)` · `await sync.unserve(name)` |
| 43 | |
| 44 | Start or stop announcing a repo on its topic. |
| 45 | |
| 46 | #### `await sync.addRemote(name, topic)` · `sync.removeRemote(name)` |
| 47 | #### `await sync.pull(name)` |
| 48 | |
| 49 | Fetch from a served remote. Missing objects are detected with `git fsck` and re-fetched rather |
| 50 | than left to fail later. |
| 51 | |
| 52 | #### `sync.info(name)` · `sync.status()` |
| 53 | |
| 54 | ## Test |
| 55 | |
| 56 | ```sh |
| 57 | npm test # 19/19 |
| 58 | ``` |
| 59 | |
| 60 | ## License |
| 61 | |
| 62 | Not yet declared. |