createDownloadAllStream = (remoteDatabase, storageDir, remote) => {
  if (!remote.downloadAll) {
    return through((entry, enc, cb) => cb(null, entry))
  }

  const indices = getEntryIndices(remoteDatabase.data)
  const entryIds = remoteDatabase.data.map(entry => entry.id)

  const downloadPreviews = async (entry) => {
    await Promise.allSettled(entry.previews.map(preview => {
      if (remote.forceDownload) {
        return fetchFile(remote, preview, storageDir)
      }
      const localFile = path.resolve(storageDir, preview)
      return access(localFile).catch(() => {
        return fetchFile(remote, preview, storageDir)
      })
    }))
  }

  return through(function(entry, enc, cb) {
    const firstFile = entry.files[0]
    if (!indices.includes(firstFile.index) || entryIds.includes(entry.id)) {
      return cb(null, entry)
    }

    downloadPreviews(entry).finally(() => cb(null, entry))
  })
}
@param {import('./types').RemoteDatabase} remoteDatabase
@param {string} storageDir
@param {import('./types').Remote} remote