$ npm install pear-provision-recoverRecover a lost provision drive by replicating its content from the network into a new drive with a new keypair.
For the case where the original secret key is lost — the content still lives on remote peers, but nobody can write to the original drive anymore. This tool creates a new writable drive that holds a copy of the remote content.
An existing network of nodes must be seeding the original drive. Recovery cannot bootstrap from nothing.
npm install -g pear-provision-recover
pear-provision-recover --path <storage> --key <key> --length <n> --blobs-length <n> --primary-key <primary-key> --name <name>
| Flag | Description |
|---|---|
--path <path> | Corestore storage path |
--key <key> | Remote provision drive public key |
--length <n> | Number of metadata blocks to recover |
--blobs-length <n> | Number of blob blocks to recover |
--primaryKey <key> | Local store primary key (optional) |
--name <name> | Local store namespace (default: local) |
const Recovery = require('pear-provision-recover')
const recover = new Recovery(swarm, store, opts)Create a recovery instance.
swarm — a Hyperswarm instance used for replicationstore — a Corestore instance for local storageopts.key — remote drive public key (string or buffer, required)opts.length — number of remote metadata blocks to downloadopts.blobsLength — number of remote blob blocks to downloadopts.name — local drive namespace (default: local)await recover.ready()Opens the remote and local Hyperdrives and waits until the remote has at least length metadata blocks and blobsLength blob blocks available. Throws if the local storage has already been written to.
await recover.run()Downloads all metadata and blob blocks from the remote drive and appends them to the local drive. Emits progress events during the transfer:
metadata-sync — { block, total } after each metadata blockblobs-sync — { block, total } after each blob blockawait recover.seed()Waits until remote peers have downloaded the full contents of the local drive (both metadata and blobs).
await recover.close()Destroys the swarm and closes the store.
Apache-2.0