21 lines
409 B
Markdown
21 lines
409 B
Markdown
# Tutorial: Drive Mirroring
|
|
|
|
## Sync Two Drives
|
|
|
|
```js
|
|
const Hyperdrive = require('hyperdrive')
|
|
const mirror = require('mirror-drive')
|
|
|
|
const local = new Hyperdrive(corestore)
|
|
const remote = new Hyperdrive(corestore2)
|
|
|
|
const m = mirror(local, remote)
|
|
await m.done() // Full sync
|
|
m.destroy() // Pause
|
|
```
|
|
|
|
**Diff Mirror**:
|
|
await mirror({start: local.version}, remote)
|
|
|
|
**Use**: Local fs <-> P2P, multi-device.
|