A blockstore backed by leveldb

Hierarchy (view full)

Constructors

Properties

base: MultibaseCodec<string>
db: Level<string, Uint8Array>

Methods

  • Parameters

    • opts: {
          prefix?: string;
          values: boolean;
      }
      • Optional prefix?: string
      • values: boolean

    Returns AsyncIterable<{
        key: string;
        value: Uint8Array;
    }>

  • Retrieve values for the passed keys

    Parameters

    Returns AwaitIterable<Pair>

    Example

    for await (const { key, value } of store.getMany([new Key('awesome')])) {
    console.log(`got "${key}" = "${new TextDecoder('utf8').decode(value)}"`')
    // => got "/awesome" = "datastore"
    }
  • Store the given key/value pairs

    Parameters

    Returns AwaitIterable<CID<unknown, number, number, Version>>

    Example

    const source = [{ key: new Key('awesome'), value: new Uint8Array([0, 1, 2, 3]) }]

    for await (const { key, value } of store.putMany(source)) {
    console.info(`put content for key ${key}`)
    }