stores
    Preparing search index...

    A blockstore backed by the file system

    Implements

    Index

    Constructors

    Properties

    path: string

    Methods

    • Retrieve all cid/block pairs from the blockstore as an unordered iterable

      Parameters

      Returns AsyncIterable<Pair>

      for await (const { multihash, block } of store.getAll()) {
      console.log('got:', multihash, block)
      // => got MultihashDigest('Qmfoo') Uint8Array[...]
      }
    • Retrieve values for the passed keys

      Parameters

      Returns AsyncIterable<Pair>

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

      Parameters

      Returns Promise<boolean>

      const exists = await store.has(new Key('awesome'))

      if (exists) {
      console.log('it is there')
      } else {
      console.log('it is not there')
      }
    • Store the given key/value pairs

      Parameters

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

      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}`)
      }