Interface: File

olympe.df. File

Describes a 'File' accessible via the network.

Methods


<abstract> getContentAsBinary(onSuccess [, onFailure])

Gets the file content as an ArrayBuffer.

Parameters:
Name Type Argument Description
onSuccess function

The function to call on completion with the binary content.

onFailure function <optional>

The function to call on failure with the error reason.


<abstract> getContentAsString(onSuccess [, onFailure])

Retrieves the content of this file and returns it as an UTF-8 string. Note: this method should be used only when the file is a text file.

Parameters:
Name Type Argument Description
onSuccess function

The function to call on completion with the text content.

onFailure function <optional>

The function to call on failure with the error reason.


<abstract> getContentUrl(onSuccess [, onFailure])

Gets the URL that gives direct access to the file content:

  • For files that are external to Olympe, gives the normal URL
  • For the files stored by Olympe, provides a dataURL. Note: The method getUrl returns the url property of this file, without taking into account if the content is directly accessible with this URL (without any authentication process).
Parameters:
Name Type Argument Description
onSuccess function

The function to call on completion with the URL to access to the file content.

onFailure function <optional>

The function to call on failure with the error reason.

See:

<abstract> getFileName()

Gets the file name.

Returns:

The name.

Type
olympe.df.POString

<abstract> getMimeType()

Gets the file MIME type.

Returns:

The MIME type.

Type
olympe.df.POString

<abstract> getName()

Gets the file name.

Deprecated:
  • - use getFileName() instead
Returns:

The name.

Type
olympe.df.POString

<abstract> getUrl()

Gets the URL for this file. Note: Some files won't be accessible via the URL alone because they will need authentication for permission checking. getContentURL will, on the other hand, always return a directly accessible URL.

See:
Returns:

The URL.

Type
olympe.df.POString

<abstract> rename(newName [, callback])

Renames the file. Will pass 'true' to the provided callback once the operation is successfully completed, false otherwise.

Parameters:
Name Type Argument Description
newName string | olympe.df.POString

The new name.

callback function <optional>

Function that will be called on completion.