Constructor
new FileStorage()
Extends
Classes
Members
block :number
文件分块大小。
Type:
- number
contactService :ContactService
联系人服务。
Type:
(protected) defaultRetrospect :number
- Overrides:
默认回溯时长,默认值:30个自然天。
Type:
- number
(protected) dependencies :Array.<string>
- Overrides:
模块的外部依赖。
Type:
- Array.<string>
(protected) deps :Array.<string>
- Overrides:
依赖库列表。
Type:
- Array.<string>
fileAnchors :OrderMap.<string, FileAnchor>
文件锚点。
Type:
- OrderMap.<string, FileAnchor>
fileHierarchyMap :OrderMap.<number, FileHierarchy>
文件层级表。键为层级对应的联系人ID或群组ID。
Type:
- OrderMap.<number, FileHierarchy>
fileLabels :OrderMap.<string, FileLabel>
缓存的文件标签。键为文件码。
Type:
filePipeline :AjaxPipeline
文件数据通道。
Type:
fileURL :string
主机 URL 地址。
Type:
- string
(protected) kernel :Kernel
- Overrides:
内核对象。
Type:
NAME :string
模块名。
Type:
- string
(protected) name :string
- Overrides:
模块名称。
Type:
- string
(protected) pipeline :Pipeline
- Overrides:
模块使用的默认数据管道。
Type:
pipelineListener :FileStoragePipeListener
默认管道的监听器。
Type:
(protected) pluginSystem :PluginSystem
- Overrides:
消息插件系统。
Type:
secure :boolean
是否是安全连接。
Type:
- boolean
(protected) started :boolean
- Overrides:
是否已启动。
Type:
- boolean
storage :FileStructStorage
结构存储库。
Type:
Methods
config(config)
- Overrides:
配置模块。
Parameters:
Name | Type | Description |
---|---|---|
config |
JSON | 配置信息。 |
deleteDirectory(workingDir, pendingDir, recursive, handleSuccess, handleFailure)
删除目录。
Parameters:
Name | Type | Description |
---|---|---|
workingDir |
Directory | 当前工作目录。 |
pendingDir |
Directory | Array | 待删除目录或者目录 ID 。 |
recursive |
boolean | 是否递归删除所有子文件和子目录。 |
handleSuccess |
function | 成功回调。参数:( |
handleFailure |
function | 失败回调。参数:( |
deleteFile(workingDir, fileCodes, handleSuccess, handleFailureopt)
删除指定目录下的文件。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
workingDir |
Directory | 指定当前工作目录。 |
|
fileCodes |
Array | 指定待删除的文件码列表。 |
|
handleSuccess |
function | 成功回调。参数:( |
|
handleFailure |
function |
<optional> |
失败回调。参数:( |
downloadFile(fileOrFileCode)
下载文件。
Parameters:
Name | Type | Description |
---|---|---|
fileOrFileCode |
FileLabel | string | 文件标签或文件码。 |
emptyTrash(handleSuccess, handleFailureopt)
清空回收站里所有文件和文件夹。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
handleSuccess |
function | 成功回调。参数:( |
|
handleFailure |
function |
<optional> |
失败回调。参数:( |
eraseTrash(trashIdList, handleSuccess, handleFailureopt)
抹除回收站里的指定废弃数据。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
trashIdList |
Array.<number> | 指定待抹除数据的 ID 列表。 |
|
handleSuccess |
function | 成功回调。参数:( |
|
handleFailure |
function |
<optional> |
失败回调。参数:( |
getAuthToken() → {AuthToken}
- Overrides:
获取访问令牌。
Returns:
返回当前存储的访问令牌,如果没有获得令牌返回 null
值。
- Type
- AuthToken
getFileLabel(fileCode, handleSuccess, handleFailureopt)
获取文件标签。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fileCode |
string | 指定文件码。 |
|
handleSuccess |
function | 获取到数据回调该方法,参数:( |
|
handleFailure |
function |
<optional> |
未能找到数据回调该方法,参数:( |
getFileURL(fileCodeOrLabel, handler)
获取文件的访问 URL 。
Parameters:
Name | Type | Description |
---|---|---|
fileCodeOrLabel |
string | 文件码。 |
handler |
function | 回调函数,函数参数:( |
getName() → {string}
- Overrides:
获取模块名称。
Returns:
返回模块名称。
- Type
- string
getPluginSystem() → {PluginSystem}
- Overrides:
获取插件系统对象实例。
Returns:
返回插件系统对象实例。
- Type
- PluginSystem
getSelfRoot(handleSuccess, handleFailure)
获取当前登录联系人的个人文件根目录。
Parameters:
Name | Type | Description |
---|---|---|
handleSuccess |
function | 成功回调。参数:( |
handleFailure |
function | 失败回调。参数:( |
hasStarted() → {boolean}
- Overrides:
是否已启动过该模块。
Returns:
如果已启动返回 true
,否则返回 false
。
- Type
- boolean
isReady() → {boolean}
- Overrides:
模块是否就绪。
Returns:
如果模块就绪返回 true
。
- Type
- boolean
listTrash(begin, end, handleSuccess, handleFailureopt)
罗列当前登录联系人文件回收站里的废弃数据。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
begin |
number | 开始索引。 |
|
end |
number | 结束索引。 |
|
handleSuccess |
function | 成功回调。参数:( |
|
handleFailure |
function |
<optional> |
失败回调。参数:( |
newDirectory(workingDir, newDirName, handleSuccess, handleFailure)
新建目录。
Parameters:
Name | Type | Description |
---|---|---|
workingDir |
Directory | 当前工作目录。 |
newDirName |
string | 新目录名。 |
handleSuccess |
function | 成功回调。参数:( |
handleFailure |
function | 失败回调。参数:( |
on(eventopt, listener)
- Overrides:
- See:
设置指定事件的监听回调函数。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
string |
<optional> |
指定事件名。 |
listener |
function | 当发生该事件时回调此函数,函数参数参看 ModuleEvent 。 |
querySearch(directoryId, fileCode) → {SearchItem}
查询之前有效的搜索结果。
Parameters:
Name | Type | Description |
---|---|---|
directoryId |
number | string | 目录 ID 。 |
fileCode |
string | 文件码。 |
Returns:
返回搜索结果项。
- Type
- SearchItem
querySelfDirectory(id) → {Directory}
获取指定 ID 的目录。
Parameters:
Name | Type | Description |
---|---|---|
id |
number | string | 目录 ID 。 |
Returns:
返回指定 ID 的目录。
- Type
- Directory
renameDirectory(workingDir, pendingDir, newDirName, handleSuccess, handleFailure)
重命名目录。
Parameters:
Name | Type | Description |
---|---|---|
workingDir |
Directory | |
pendingDir |
Directory | |
newDirName |
string | |
handleSuccess |
function | |
handleFailure |
function |
require(moduleName)
- Overrides:
声明该模块依赖的其他模块。
Parameters:
Name | Type | Description |
---|---|---|
moduleName |
string |
requireFile(fileOrURL, successCallbackopt, failureCallbackopt)
- Overrides:
请求外部依赖库文件。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fileOrURL |
string | 文件或者文件的 URL 。 |
|
successCallback |
function |
<optional> |
|
failureCallback |
function |
<optional> |
restoreTrash(trashIdList, handleSuccess, handleFailure)
从回收站恢复指定数据。
Parameters:
Name | Type | Description |
---|---|---|
trashIdList |
Array | 废弃数据的 ID 列表。 |
handleSuccess |
function | 成功回调。参数:( |
handleFailure |
function | 失败回调。参数:( |
resume()
- Overrides:
恢复模块。
searchFile(filter, handleSuccess, handleFailureopt)
搜索文件。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filter |
SearchFilter | 指定搜索过滤条件。 |
|
handleSuccess |
function | 成功回调。参数:( |
|
handleFailure |
function |
<optional> |
失败回调。参数:( |
start() → {boolean}
- Overrides:
启动模块。
Returns:
返回 false
表示模块不再需要执行启动流程。
- Type
- boolean
stop()
- Overrides:
停止模块。
suspend()
- Overrides:
挂起模块。
uploadFile(file, handleProcessingopt, handleSuccessopt, handleFailureopt) → {FileAnchor}
上传指定的文件。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
file |
File | 指定上传文件。 |
|
handleProcessing |
function |
<optional> |
正在进行文件处理的回调函数。函数参数:( |
handleSuccess |
function |
<optional> |
上传文件成功的回调函数。函数参数:( |
handleFailure |
function |
<optional> |
上传文件失败的回调函数。函数参数:( |
Returns:
返回文件锚。
- Type
- FileAnchor