@synonymdev/slashdrive v1.0.0-alpha.22
slashdrive
Drivestore is a Hyperdrive factory that makes it easier to manage large collections of named Hyperdrives.
Features
- Public unencrypted drive
- Creates and keep track of all created encrypted private drives
Installation
npm install @synonymdev/slashdriveUsage
import Corestore from 'corestore'
import Drivestore from '@synonymdev/slashdrive'
const corestore = new Corestore('./corestore_dir')
const store = new Drivestore(corestore, keyPair)
const publicDrive = store.get('public') // or store.get()
const privateDrive = store.get('foo') // returns an encrypted HyperdriveAPI
const drivestore = new Drivestore(corestore, keyPair)
Create new Drivestore.
corestoremust be an instance of Corestore.If the instance is a namespace, the internal corestore will reset its namespace to the
DEFAULT_NAMESPACE(32 0-bytes).keyPairpublic and secret keys to create the public Hyperdrive, the secret key will be used as theprimaryKeyfor the internal corestore.
await drivestore.ready()
Awaits opening metadata hypercore. Useful before async iterating over all created drives.
const hyperdrive = drivestore.get([name])
Returns an encrypted Hyperdrive for a given name.
If name is undefined or equal to /public it will return a public unencrypted drive, by the same keypair passed to the contsructor.
const stream = drivestore.replicate(stream)
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago