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

trying to connect to a beaker hyperdrive getting 'TypeError: expected a string' #94

Closed ryanramage closed 2 years ago

ryanramage commented 2 years ago

trying to follow the docs in the readme, but getting an error

TypeError: expected a string
    at normalizePath (/Users/ryanr/github/ryanramage/hypermls/node_modules/normalize-path/index.js:12:11)
    at unixify (/Users/ryanr/github/ryanramage/hypermls/node_modules/unixify/index.js:13:14)
    at fixName (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:1314:10)
    at HyperdriveCompat.lstat (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:734:12)
    at HyperdriveCompat.stat (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:763:10)
    at HyperdriveCompat.stat (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:760:49)
    at HyperdriveCompat._walk (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:1079:10)
    at HyperdriveCompat.download (/Users/ryanr/github/ryanramage/hypermls/node_modules/hyperdrive/index.js:1062:17)
    at Proxy.method (/Users/ryanr/github/ryanramage/hypermls/node_modules/@geut/hyperdrive-promise/index.js:61:37)
    at module.exports (/Users/ryanr/github/ryanramage/hypermls/lib/run.js:19:15)

on the following code

const SDK = require('hyper-sdk')
const ram = require('random-access-memory')
module.exports = async () => {

  const sdk = await SDK({
    persist: false,
    storage: ram
  })
  const {
    Hypercore,    // Create a new Hypercore
    Hyperdrive,   // Create a new Hyperdrive
    resolveName,  // Resolve hyper:// address to key using hyper-dns
    close         // Cleanup all hyper related resources
  } = sdk

  const SOME_URL = 'hyper://738fd43caa1c80954cc681b0139580652d4eff32f5eab26b6dfdebea5885ea4b/'
  const drive = Hyperdrive(SOME_URL)

  await drive.download()
  console.log(await somedrive.readdir('/'))
}

anything you see wrong with it @RangerMauve ?

ryanramage commented 2 years ago

seems the await drive.download() needs a string path, eg await drive.download('/')