function getDownloadURL (type, name, cid, gatewayUrl) {
  if (type === 'directory') {
    const filename = `${name || `download_${cid.toString()}`}.tar`
    return `${gatewayUrl}/ipfs/${cid.toString()}?download=true&format=tar&filename=${filename}`
  } else {
    const filename = `${name || cid}`
    return `${gatewayUrl}/ipfs/${cid.toString()}?download=true&filename=${filename}`
  }
}
@param {string} type
@param {string} name
@param {CID} cid
@param {string} gatewayUrl
@returns {string}