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

DAT version discrepancies #224

@martinheidegger

Description

@martinheidegger

(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' ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions