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

TypeError: path is undefined

Open mathiversen opened this issue 5 years ago • 5 comments

I followed the example on https://docs.dat.foundation/docs/browser-intro but i get TypeError: path is undefined, using this code:

var dat = new Dat()
var archive = dat.create({
    persist: true
})
archive.writeFile('/example.txt', 'Hello World!', () => {
    localStorage.setItem('My_Repo', archive.url)
})

Removing .posix in hyperdrive seemed to do the trick but I'm not sure if anything else needs to be updated as well.

mathiversen avatar Jan 08 '20 09:01 mathiversen

Pushed the wrong button ^^ Guessing most of the work is put into dat-sdk now? Maybe the examples on the dat web needs to be updated?

mathiversen avatar Jan 08 '20 09:01 mathiversen

I think this just needed a small bump in the version of hyperdrive that's being used. Maybe check out the version that the SDK uses? Sadly, nobody has had time to update the docs. 😅 I'll try to prioritize it after getting some other stuff done.

A PR fixing this issue would be very much appreciated by the way.

RangerMauve avatar Jan 08 '20 22:01 RangerMauve

There seems to be something more than just bumping hyperdrive as 9.16.0, same as the sdk, as it still throws the undefined path. Im on ubuntu 18.04 running firefox 71.

Also the testing framework used zuul hasn't been maintained for two years and is throwing a lot of errors so ill add another issue for that.

mathiversen avatar Jan 09 '20 10:01 mathiversen

@rangermauve, is it true that dat-js is becoming obsolete as we are opting for the SDK? If so, @mathiversen you might want to try the dat-sdk module. It still needs a small bit work but it's currently feature-parity.

okdistribute avatar Jan 10 '20 18:01 okdistribute

Yeah, I'd say that dat-js is getting deprecated for dat-sdk. Same with dat-node. Part of the reason this hasn't been done more aggressively was that I was unsure about what Dat2 would look like.

But I can safely say that using the SDK would be more convenient (if the examples in the repo are enough to get you started)

RangerMauve avatar Jan 10 '20 19:01 RangerMauve