Created
August 24, 2019 08:37
-
-
Save PetkevichPavel/2e84813659f4eae0b2ca891931a4c87f to your computer and use it in GitHub Desktop.
AN_Cloud Function: Class for File extension functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Context extension function which will save the file into the device local storage. | |
* @param data - content of the file. | |
* @param fileName - name of the final file. | |
*/ | |
fun Context.saveFile(data: ByteArray, fileName: String) = | |
openFileOutput(fileName, Context.MODE_PRIVATE)?.apply { | |
write(data) | |
close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment