函数:cloud_file_list 获取云盘文件列表

函数名称:获取文件列表

函数功能:获取云盘文件列表

函数方法

ret = ts_enterprise_lib:cloud_file_list(file)

参数 类型 必填 说明
file string 需要获取文件的文件夹路径
返回值 类型 说明
ret table true - 获取成功,creat_at - 文件(夹)创建时间,name - 文件(夹)名称,
size - 文件大小,type:1 - 文件夹,0 - 文件;
false - 获取失败,error - 失败原因

函数用例

local ts = require("ts")
local json = ts.json
-- 企业版库为企业版专用库请勿在除企业版外的产品使用,此库已内置,无需下载
--如果提示没有 ts_enterprise_lib 库请重启企业版客户端服务再试
ts_enterprise_lib = require("ts_enterprise_lib")
assert(ts_enterprise_lib,"无法引入企业专用库")
--获取云盘所有文件列表(一级目录)
dialog(json.encode({ts_enterprise_lib:cloud_file_list("/")}),5)
--获取 a1 文件夹下的文件列表
--dialog(json.encode({ts_enterprise_lib:cloud_file_list("/a1/")}),5)

注意事项

  • error 返回 param path invalid(11002) 表示路径不存在或者路径错误。

  • 错误返回 timeout 请在获取数据前增加代码 ts_enterprise_lib.timeout = 20 或者增加参数: timeout_seconds 的时间,如果仍返回 timeout 请修改为 20 以上的数字

Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""