Skip to main content

UploadFileToStorage

Uploads a file to the data store.

def UploadFileToStorage(
ctx: context.Context,
filePath: string,
toPath: storage.DataReference,
size: int64,
store: storage.DataStore
) - > error

Uploads a file to the data store.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for cancellation and tracing.
filePathstringThe local file path of the file to be uploaded.
toPathstorage.DataReferenceThe destination path within the data store where the file will be stored.
sizeint64The size of the file in bytes.
storestorage.DataStoreThe data store instance to which the file will be uploaded.

Returns

TypeDescription
errorAn error if the file cannot be opened or written to the data store, otherwise nil.