@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/slashdrive
Usage
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 Hyperdrive
API
const drivestore = new Drivestore(corestore, keyPair)
Create new Drivestore.
corestore
must 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).keyPair
public and secret keys to create the public Hyperdrive, the secret key will be used as theprimaryKey
for 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)
10 months ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago