How to use the datastore-core.ShardingDatastore.open function in datastore-core

To help you get started, we’ve selected a few datastore-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / js-datastore-fs / test / index.spec.js View on Github external
it('interop with go', async () => {
    const repodir = path.join(__dirname, '/test-repo/blocks')
    const fstore = new FsStore(repodir)
    const key = new Key('CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY')
    const expected = fs.readFileSync(path.join(repodir, 'VO', key.toString() + '.data'))
    const flatfs = await ShardingStore.open(fstore)
    let res = await flatfs.get(key)
    let queryResult = flatfs.query({})
    let results = []
    for await (const result of queryResult) results.push(result)
    expect(results).to.have.length(23)
    expect(res).to.be.eql(expected)
  })