RangerMauve / hyper-sdk

Make your own hyper apps!
https://www.youtube.com/watch?v=HyHk4aImd_I&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=20
MIT License
292 stars 45 forks source link

Uncaught (in promise) Error: Not opened #70

Closed glowkeeper closed 2 years ago

glowkeeper commented 3 years ago

The very first thing I try to do with the sdk gives an error:

const SDK = require('dat-sdk')
const sdk = await SDK()

I get Uncaught (in promise) Error: Not opened :

_openAndNotClosed

What am I doing wrong?

glowkeeper commented 3 years ago

ps. if I run dat share mySharedDir/ --http then browse http://localhost:8080, I get a list of all my shared files. Essentially, that's all I want to do above, so I know it's possible :)

glowkeeper commented 3 years ago

I've attached a screengrab of the console:

Screenshot 2020-10-28 at 15 46 47

Is this something to do with webpack, too?

glowkeeper commented 3 years ago

I'm getting closer! I'm trying this:

var {
        Hyperdrive,
        close
    } = await SDK({
      persist: false
    })

    const myDat = 'dat://328c78dce8a95ad7bfdc5245a99c38e71d8dc75f5671017eec7ef75049dadd6e'
    const myArchive = Hyperdrive(myDat)
    await myArchive.ready()
    console.log(await myArchive.readdir('/'))

That gets a lot further - unfortunately, it lists an empty array, rather than the dozen or so files I'm sharing. And I get this error, now:

Screenshot 2020-10-28 at 16 34 20

I'm guessing I'm doing something wrong, but the docs' aren't very helpful... :(

RangerMauve commented 3 years ago

Hey! I'll investigate further tomorrow but I think the main issue you have right now is that the dat CLI doesn't support the latest versions of Hyperdrive.

Essentially, stuff using the dat:// URL scheme need an older version of the SDK (pre 2.0) or you can use something newer like dat-store which supports the hyper:// protocol

RangerMauve commented 2 years ago

Gonna close this for now since it's been a while and there hasn't been any updates. 😅