跳至主要內容

計算檔案 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