download

Downloads a file from the device.

The download starts when the flow is collected, and is cancelled when the collection is. The data is delivered with TransferState.Completed.

Parameters

name

The path of the file on the device.

Throws

if the download fails.


fun download(name: String, output: OutputStream): Flow<TransferState<Unit>>

Downloads a file from the device, writing it to the given stream.

The download starts when the flow is collected, and is cancelled when the collection is. The stream is not closed.

Parameters

name

The path of the file on the device.

output

The stream to write the file to.

Throws

if the download fails.