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

dat.archive.mkdir() not creating a dir #164

Open
benrogmans opened this issue Jul 20, 2017 · 2 comments
Open

dat.archive.mkdir() not creating a dir #164

benrogmans opened this issue Jul 20, 2017 · 2 comments

Comments

@benrogmans
Copy link

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

dat.archive.mkdir('/my-dir', function(err){
	console.log(err);
});
@benrogmans benrogmans changed the title dat.archive.mkdir() dat.archive.mkdir() not creating a dir Jul 20, 2017
@joehand
Copy link
Collaborator

joehand commented Jul 20, 2017

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.

@chartgerink
Copy link
Contributor

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)
})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants