transfer

suspend fun transfer(writeStream: OutputStream, readStream: InputStream, length: Long?, downloadProgress: (Long, Long?) -> Unit, digest: DigestPair?)(source)

Write the "readStream" to the "writeStream", while notifying the "downloadProgress" and calculating the digest

throws a DigestException if the Digest can be calculated (non-null + correct algorithm), and is mismatched

throws a CancellationException if canceled, but may not be "instant" if the read is blocking

throws IOException and similar for reading

In case of crashes from the digest, we ignore it as we do not want to "block" someone from updating if they got a broken OS without the desired algorithm or implementation.

This is because a malicious CDN should not be able to "crash" the algorithm, but a broken OS will. And recovering from a broken OS by ignoring it is better than refusing it.