Class: FileServiceManager

olympe.dc. FileServiceManager

The file service manager is the entry point to work with instances of files persisted in the datacloud.


<package> new FileServiceManager(logger, netManager, router, binaryConverter, activateCache)

Creates an instance of FileServiceManager.

Parameters:
Name Type Description
logger olympe.logging.Channel
netManager olympe.net.Manager
router olympe.dc.Router
binaryConverter olympe.utils.BinaryConverter
activateCache boolean

Methods


createFile(tag, data, mimeType, onSuccess [, onFailure] [, activateCache])

Creates an entry in the file service with the given tag.

Parameters:
Name Type Argument Default Description
tag string

The tag of the file.

data string | Blob | ArrayBuffer | olympe.df.OString

Initial content for the file.

mimeType string
onSuccess function

Callback to invoke with the file's path if the creation was successful.

onFailure function <optional>

Callback to invoke with the error code if the creation failed.

activateCache boolean <optional>
true

Whether the uploaded file content must be put in cache or not


deleteFile(file, onSuccess [, onFailure])

Deletes a File.

Parameters:
Name Type Argument Description
file olympe.dm.File

The file to delete.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.


downloadFile(file, onSuccess [, onFailure] [, activateCache])

Downloads the content of a File.

Parameters:
Name Type Argument Default Description
file olympe.dm.File

The file to download.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.

activateCache boolean <optional>
true

Whether the downloaded file content must be put in cache or not


uploadFile(file, data, onSuccess [, onFailure] [, activateCache])

Updates the content of file with new data.

Parameters:
Name Type Argument Default Description
file olympe.dm.File

The file to update.

data string | Blob | ArrayBuffer | olympe.df.OString

New content for that file.

onSuccess function

Callback to invoke if the operation is successful.

onFailure function <optional>

Callback to invoke if the operation failed.

activateCache boolean <optional>
true

Whether the uploaded file content must be put in cache or not