createFile

fun StoreFileStreamWriter.Companion.createFile(api: StoreApi, storeId: String, publicMeta: ByteArray, privateMeta: ByteArray, size: Long, inputStream: InputStream, streamController: StoreFileStream.Controller? = null): String

Creates new file in given Store and writes data from given InputStream.

Return

ID of the created file

Parameters

api

reference to Store API

storeId

ID of the Store

publicMeta

byte array of any arbitrary metadata that can be read by anyone

privateMeta

byte array of any arbitrary metadata that will be encrypted before sending

size

size of data to write

inputStream

stream with data to write to the file using optimal chunk size StoreFileStream.OPTIMAL_SEND_SIZE

streamController

controls the process of writing file

Throws

if there is an error while reading stream or this is closed

when storeApi is not initialized or there's no connection

if there is an error while creating Store file metadata

if there is an unknown error while creating Store file metadata