函数:cloud_file_pull 从云盘下载文件

方法名称:从云盘下载文件

方法功能:从云盘中下载一个文件到本地

调用方法

ok,err = ts_enterprise_lib:cloud_file_pull(local_file,cloud_file_name,timeout_seconds);

参数 类型 必填 说明 默认值
local_file string 本地文件路径,需包含完整文件名 -
cloud_file_name string 云盘文件路径,需包含完整文件名 -
timeout_seconds number 超时时间,单位秒。数据较大时,应适当延长 5
返回值 类型 说明
ok boolean 操作结果,成功返回 true,失败返回 false
err string 当 ok 等于 true,无返回值
当 ok 等于 false,返回错误原因

函数用例

-- 企业版库为企业版专用库请勿在除企业版外的产品使用,此库已内置,无需下载
--如果提示没有 ts_enterprise_lib 库请重启企业版客户端服务再试
ts_enterprise_lib = require("ts_enterprise_lib")
assert(ts_enterprise_lib,"无法引入企业专用库")
local local_file = userPath().."/1.lua"          --本地文件名
local cloud_file_name = "/aaa/bbb/脚本2.lua"     --云盘文件名,包含目录的完整文件名
local timeout_seconds = 5;                      --超时秒数,数据较大时,适当延长
local ok,err = ts_enterprise_lib:cloud_file_pull(local_file,cloud_file_name,timeout_seconds)
if ok then
    dialog("下载成功",5)
else
    dialog("下载失败,失败原因:"..err,5)
end

注意事项

  • 错误返回 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 ""