writeFileInCache

suspend fun writeFileInCache(context: Context, fileName: String, source: InputStream): Result<File>

Writes data from an InputStream to a cache file.

The file is created in the Stream cache directory. If a file with the same name already exists, it will be overwritten.

Return

Result.Success with the cached File, or Result.Failure with an error

Parameters

context

Android context for cache directory access

fileName

Name of the file to create in cache

source

InputStream containing the data to cache