code: function readdir (archive, name, opts, cb) {
    if (typeof opts === 'function') {
      cb = opts
      opts = {}
    }
    opts = opts || {}
  
    return maybe(cb, async function () {
      // options
      var recursive = (opts && !!opts.recursive)
  
      // run first readdir
      var promise = new Promise((resolve, reject) => {
        archive.readdir(name, (err, names) => {
          if (err) reject(toBeakerError(err, 'readdir'))
          else resolve(names)
        })
      })
      var results = await promise
  
      // recurse if requested
      if (recursive) {
        var rootPath = name
        const readdirSafe = name => new Promise(resolve => {
          archive.readdir(name, (_, names) => resolve(names || []))
        })
        const recurse = async function (names, parentPath) {
          await Promise.all(names.map(async function (name) {
            var thisPath = path.join(parentPath, name)
            var subnames = await readdirSafe(thisPath)
            await recurse(subnames, thisPath)
            results = results.concat(subnames.map(subname => normalize(rootPath, thisPath, subname)))
          }))
        }
        await recurse(results, name)
      }
      return results
    })
  }
docs: helper to list the files in a directory