async function startDaemon (opts) {
  const ipfsd = await getIpfsd(opts.flags, opts.path)
  if (ipfsd === null) {
    app.quit()
    return { ipfsd: undefined, err: new Error('get ipfsd failed'), id: undefined, logs: '' }
  }

  let { err, logs, id } = await startIpfsWithLogs(ipfsd)
  if (err) {
    if (!err.message.includes('ECONNREFUSED') && !err.message.includes('ERR_CONNECTION_REFUSED')) {
      return { ipfsd, err, logs, id }
    }

    if (!configExists(ipfsd)) {
      dialogs.cannotConnectToApiDialog(ipfsd.apiAddr.toString())
      return { ipfsd, err, logs, id }
    }

    logger.info('[daemon] removing api file')
    removeApiFile(ipfsd)

    const errLogs = await startIpfsWithLogs(ipfsd)
    err = errLogs.err
    logs = errLogs.logs
    id = errLogs.id
  }

  // If we have an error here, it should have been handled by startIpfsWithLogs.
  return { ipfsd, err, logs, id }
}
Start the IPFS daemon.

@param {any} opts
@returns {Promise<{ ipfsd: import('ipfsd-ctl').Controller|undefined } & IpfsLogs>}