createFile

fun createFile(api: StoreApi, storeId: String, publicMeta: ByteArray, privateMeta: ByteArray, size: Long): StoreFileStreamWriter

Creates a new file in given Store.

Return

Instance ready to write to the created Store 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

Throws

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


fun createFile(api: StoreApi, storeId: String, publicMeta: ByteArray, privateMeta: ByteArray, size: Long, source: Source, streamController: StoreFileStream.Controller? = null): String

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

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

source

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

streamController

controls the process of writing file

Throws

IOException

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