cloudFile¶
The cloudFile (a.k.a. fileLink) API first appeared in Thunderbird 64, and was uplifted to Thunderbird 60.4 ESR.
From Thunderbird 68.2.1 (Thunderbird 71 beta), an extension can choose to receive data for upload
as a File
object rather than as an ArrayBuffer
. You should specify which you want as
the default may change in a future version.
The DropBox Uploader sample extension uses this API.
Manifest file properties¶
[cloud_file
]
(object)
management_url
(string)
A page for configuring accounts, to be displayed in the preferences UI. Note: Within this UI only a limited subset of the WebExtension APIs is available: cloudFile, extension, i18n, runtime, storage, test.
name
(string)
Name of the cloud file service.
[data_format
]
(string)
– [Added in TB 71, backported to TB 68.2.1]
Determines the format of the data
argument in onFileUpload
.
Supported values:
ArrayBuffer
File
[new_account_url
]
(string) Deprecated.
This property was never used.
[service_url
]
(string)
URL to the web page of the cloud file service.
Functions¶
getAccount(accountId)¶
Retrieve information about a single cloud file account
Parameters
accountId
(string)
Unique identifier of the account
Return type (Promise)
getAllAccounts()¶
Retrieve all cloud file accounts for the current add-on
Return type (Promise)
array of CloudFileAccount
updateAccount(accountId, updateProperties)¶
Update a cloud file account
Parameters
accountId
(string)
Unique identifier of the account
updateProperties
(object)
[configured
]
(boolean)
If true, the account is configured and ready to use. This property is currently ignored and all accounts are assumed to be configured.
[managementUrl
]
(string)
A page for configuring accounts, to be displayed in the preferences UI.
[spaceRemaining
]
(integer)
The amount of remaining space on the cloud provider, in bytes. Set to -1 if unsupported.
[spaceUsed
]
(integer)
The amount of space already used on the cloud provider, in bytes. Set to -1 if unsupported.
[uploadSizeLimit
]
(integer)
The maximum size in bytes for a single file to upload. Set to -1 if unlimited.
Return type (Promise)
Events¶
onFileUpload(account, fileInfo)¶
Fired when a file should be uploaded to the cloud file provider
Parameters for event listeners
The created account
The file to upload
Expected return value of event listeners
object
[aborted
]
(boolean)
Set this to true if the file upload was aborted
[url
]
(string)
The URL where the uploaded file can be accessed
onFileUploadAbort(account, fileId)¶
Parameters for event listeners
The created account
fileId
(integer)
An identifier for this file
onFileDeleted(account, fileId)¶
Fired when a file previously uploaded should be deleted
Parameters for event listeners
The created account
fileId
(integer)
An identifier for this file
onAccountAdded(account)¶
Fired when a cloud file account of this add-on was created
Parameters for event listeners
The created account
onAccountDeleted(accountId)¶
Fired when a cloud file account of this add-on was deleted
Parameters for event listeners
accountId
(string)
The id of the removed account
Types¶
CloudFile¶
Information about a cloud file
object
id
(integer)
An identifier for this file
name
(string)
Filename of the file to be transferred
CloudFileAccount¶
Information about a cloud file account
object
configured
(boolean)
If true, the account is configured and ready to use. This property is currently ignored and all accounts are assumed to be configured.
id
(string)
Unique identifier of the account
managementUrl
(string)
A page for configuring accounts, to be displayed in the preferences UI.
name
(string)
A user-friendly name for this account.
[spaceRemaining
]
(integer)
The amount of remaining space on the cloud provider, in bytes. Set to -1 if unsupported.
[spaceUsed
]
(integer)
The amount of space already used on the cloud provider, in bytes. Set to -1 if unsupported.
[uploadSizeLimit
]
(integer)
The maximum size in bytes for a single file to upload. Set to -1 if unlimited.