Properly identifying symlinks

I am experimenting with indexing contents of a directory into PouchDB for easier browsing of large deep trees.

I want to be able to handle symlinks. I’m able to get the raw data using ipfs.block.get. The type returned from ipfs.ls is unknown. Are there things other than symlinks with a type of unknown? If so, do other unknowns than symlinks have a first byte of 10?

Here is the start I have on reading the directory structure:

const listDir = async (key, path = []) => {
  const list = await ipfs.ls(key)
  list.forEach(async (entry) => {
    const name = `${path.join('/')}/${entry.name}`
    switch(entry.type) {
      case 'dir':
        console.log(`Dir: "${name}": Recursing`)
        listDir(`${key}/${entry.name}`, [...path, entry.name])
        break
      case 'file':
        console.log(`File: "${name}": ${entry.hash}`)
        break
      default:
        const block = await ipfs.block.get(entry.hash)
        if(block.data[0] === 10) {
          console.log(`Link: "${name}": ${block.data.slice(6)}`)
        } else {
          console.log(`Unknown: "${name}": ${block.data}`)
        }
        break
    }
  })
}

Might be a bug - are you using js-ipfs or js-ipfs-http-client?

I’m using the IPFS Companion with the IPFS Desktop, so I assume the window.ipfs it provides is using the js-ipfs-http-client.

What are you suggesting is a bug? The fact that ipfs.ls returns a type of unknown for symlinks?