Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

issue with { indexing: true } #7

@juliangruber

Description

@juliangruber

This fails:

const fs = require('fs')
const hyperdrive = require('hyperdrive')
const src = `/tmp/${Math.random()}/`
console.log(src)
const storage = require('dat-storage')(src)

const archive = hyperdrive(storage, { latest: true, indexing: true })
archive.writeFile('/dat.json', 'hi', err => {
  if (err) throw err // => ok

  console.log(fs.readFileSync(`${src}/dat.json`)) // => empty

  archive.readFile('/dat.json', (err, data) => {
    if (err) throw err // => error (couldn't satisfy length)
    console.log('data', data)
  })
})

with message

Error: Could not satisfy length
    at onread (/Users/julian/dev/datproject/multidat/node_modules/random-access-file/index.js:122:17)

The file on disk is also empty - although it exists.

The snippet can by fixed by setting { indexing: false }.

I'm not sure yet what's going on here but this makes multidat tests fail for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions