ShareAPI

ShareAPI

Provides the APIs for managing the logged-in user's shared files. Instances of this class should be obtained using system.shares.

Methods

changeSharing(fileName, enableLinkSharing, expiryDateUtc, setPassword, password) → {ShareInfo}

Description:
  • Change the sharing details of a previously shared file.

Source:
Parameters:
Name Type Description
fileName String

Name of the file.

enableLinkSharing Boolean

Should the file be shared?

expiryDateUtc Date

(Optional) expiry date of the share (UTC).

setPassword Boolean

Is the file being shared with a password?

password String

(Optional) password of the share.

Returns:
Type
ShareInfo

getShareDirectoryPaths() → {ShareDirectoryPaths}

Description:
  • Returns directory paths related to file-sharing.

Source:
Returns:
Type
ShareDirectoryPaths

getShareInfo(fullSharePath) → {ShareInfo}

Description:
  • Returns sharing information of the file at the specified path in the virtual file-system.

Source:
Parameters:
Name Type Description
fullSharePath String

Absolute path of a file in the virtual file-system. Note that this is not just share name of a shared file.

Returns:
Type
ShareInfo

list() → {Array.<ShareInfo>}

Description:
  • Returns an Array containing information about each share.

Source:
Returns:
Type
Array.<ShareInfo>

removeFile(fileName)

Description:
  • Removes a file from the sharing index. Note that this DOES NOT DELETE THE FILE itself.

Source:
Parameters:
Name Type Description
fileName String

Name of the file to remove from the index.

shareFile(fileName, config) → {String}

Description:
  • Add a file to the share index as specified by the config argument. The file must be uploaded to the userShareDirectoryPath as returned by getShareDirectoryPaths().

Source:
Parameters:
Name Type Description
fileName String

Name of the file to be shared.

config ShareConfig

Instructions for how the file is to be shared.

Returns:

Path of the share within the virtual file-system. This, appended to the hostname, is the sharing URL.

Type
String

storeFile(fileName, expectedFileSize)

Description:
  • Add a file to the share index without sharing it. The file must be uploaded to the userShareDirectoryPath as returned by getShareDirectoryPaths().

Source:
Parameters:
Name Type Description
fileName String

Name of the file to be stored.

expectedFileSize Number

Size of the file to be stored.