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

DAT version discrepancies #224

Open
martinheidegger opened this issue Nov 27, 2018 · 1 comment
Open

DAT version discrepancies #224

martinheidegger opened this issue Nov 27, 2018 · 1 comment

Comments

@martinheidegger
Copy link
Contributor

martinheidegger commented Nov 27, 2018

(note: I am not sure if this is an issue of hyperdrive or dat-node, following @Karissa 's suggestion to post it here - thanks @Karissa )

I am reporting a bug or unexpected behavior:

The version of a newly created DAT when .ready is called persists at 0, even if a dedicated version is specified.

Bug Report

  • Operating system: Mac OS 10.13.6
  • Node Version: 10.12.0
  • dat-node Version: 3.5.15

Expected behavior

I am expecting the following code to properly list the version & files of that version.

const createDat = require('dat-node')

createDat(`${__dirname}/download`, {
  key: 'dat://56ff8bae4339defdb4bbe4e18d3fb5c17806429d59ce2e775b7832501c8781d1/',
  version: 11,
  temp: true
}, function (err, dat) {
  if (err) throw err
 
  dat.joinNetwork()
  
  dat.archive.ready(function () {
    console.log(`Version on ready: ${dat.archive.version}`)
  })

  dat.archive.readdir('/', function (err, list) {
    if (err) throw err
    console.log(`Version on list: ${dat.archive.version}`)
    console.log(list)
  })
})

to have following output

Version on ready: 11
Version on list: 11
[ 'LICENSE', 'README.md', 'images', 'dat.json', 'index.html' ]

Actual behavior

Version on ready: 0
Version on list: 11
[ 'LICENSE', 'README.md', 'images', 'dat.json', 'index.html' ]
@martinheidegger martinheidegger changed the title DAT version indescrepancies. DAT version discrepancies Nov 27, 2018
@joehand
Copy link
Collaborator

joehand commented Nov 27, 2018

Ya, I've seen this before.

I think this happens when metadata isn't downloaded, returning a length of 0. But when I saw it before, it wasn't clear if that was a bug or something we should expect to happen.

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

No branches or pull requests

2 participants