How to use the datastore-core.shard.NextToLast 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('sharding files', async () => {
    const dir = utils.tmpdir()
    const fstore = new FsStore(dir)
    const shard = new sh.NextToLast(2)
    await ShardingStore.create(fstore, shard)

    const file = await fsReadFile(path.join(dir, sh.SHARDING_FN))
    expect(file.toString()).to.be.eql('/repo/flatfs/shard/v1/next-to-last/2\n')

    const readme = await fsReadFile(path.join(dir, sh.README_FN))
    expect(readme.toString()).to.be.eql(sh.readme)
    await rimraf(dir)
  })
github ipfs / js-datastore-fs / test / index.spec.js View on Github external
setup: () => {
        const shard = new sh.NextToLast(2)
        return ShardingStore.createOrOpen(new FsStore(dir), shard)
      },
      teardown: () => {