dat-node icon indicating copy to clipboard operation
dat-node copied to clipboard

dat.archive.mkdir() not creating a dir

Open benrogmans opened this issue 6 years ago • 2 comments

Doesn't create a folder, doesn't return an error (err)

dat.archive.mkdir('/my-dir', function(err){
	console.log(err);
});

benrogmans avatar Jul 20 '17 12:07 benrogmans

I can also reproduce this using hyperdrive/dat-storage directly:

var hyperdrive = require('hyperdrive')
var storage = require('dat-storage')

var archive = hyperdrive(storage('./test'), {latest: true})
archive.mkdir('/my-dir', function (err) {
  console.log(err)
})

So it looks like either a bug in dat-storage or hyperdrive.

joehand avatar Jul 20 '17 17:07 joehand

I've been playing around and tested it both your way and the one below. It doesn't work even when dat-storage is eliminated, so it seems to originate from hyperdrive and not dat-storage.

var hyperdrive = require('hyperdrive')
var storage = require('dat-storage')

var archive = hyperdrive('123', {latest: true})
archive.mkdir('/my-dir', function (err) {
  console.log(err)
})

Funny thing is that if I check out version 1 of the archive and readdir it does appear?

var hyperdrive = require('hyperdrive')
var storage = require('dat-storage')

var archive = hyperdrive('123', {latest: true})
archive.checkout(1).readdir('/', (err, res) => {
        if (err) throw err

        console.log(res)
})

chartgerink avatar Apr 02 '19 10:04 chartgerink