计算文件 SHA1 (LCC.web_file.sha1)
声明
hash, err = LCC.web_file.sha1(path, timeout?)
参数
- path
字符串型,待校验的文件路径 - timeout
数值型,可选;请求超时时间(秒),默认60
返回值
- hash
字符串型,40 位十六进制 SHA1 值;失败时为nil - err
字符串型或nil,失败时的错误描述
说明
由中控侧计算文件的 SHA1 散列值。
路径不存在或不是文件时返回nil并附带错误原因。
示例
local sha1, err = LCC.web_file.sha1("/资源/config.json")
if sha1 then
print("SHA1=" .. sha1)
end