hyperdrive icon indicating copy to clipboard operation
hyperdrive copied to clipboard

Inconsistent size for directories readdir / stat

Open martinheidegger opened this issue 5 years ago • 0 comments

I noticed that when running a hyperdrive 10.8.20 that the stat returned by a readdir returns a different size:

const hyperdrive = require('hyperdrive')
const ram = require('random-access-memory')
const drive = hyperdrive(ram)
const assert = require('assert')

drive.writeFile('test/test.txt', 'hello', () => {
  drive.readdir('/', { includeStats: true }, (_, readdir) => {
    const name = readdir[0].name
    assert.equal(name, 'test')
    drive.stat(name, (_, stat) => {
      assert.equal(readdir[0].stat.size, stat.size) // should pass but fails with 0 == 5
    })
  })
})

martinheidegger avatar Apr 09 '20 17:04 martinheidegger