"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[9596],{6448:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>l,toc:()=>o});const l=JSON.parse('{"id":"XXTLanControl.lua/web-file/crc32","title":"Calculate File CRC32 (LCC.web_file.crc32)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/crc32.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/crc32","permalink":"/docs/en/XXTLanControl.lua/web-file/crc32","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":80,"frontMatter":{"sidebar_position":80},"sidebar":"tutorialSidebar","previous":{"title":"Calculate File SHA1 (LCC.web_file.sha1)","permalink":"/docs/en/XXTLanControl.lua/web-file/sha1"},"next":{"title":"Read Controller File Content (LCC.web_file.reads)","permalink":"/docs/en/XXTLanControl.lua/web-file/reads"}}');var t=r(4848),i=r(8453);const c={sidebar_position:80},s="Calculate File CRC32 (LCC.web_file.crc32)",a={},o=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"calculate-file-crc32-lccweb_filecrc32",children:"Calculate File CRC32 (LCC.web_file.crc32)"})}),"\n",(0,t.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"checksum, err = LCC.web_file.crc32(path, timeout?)\n"})}),"\n",(0,t.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["path",(0,t.jsx)(n.br,{}),"\n","String. File to check."]}),"\n",(0,t.jsxs)(n.li,{children:["timeout",(0,t.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,t.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["checksum",(0,t.jsx)(n.br,{}),"\n","String. 8-character hexadecimal CRC32; ",(0,t.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,t.jsxs)(n.li,{children:["err",(0,t.jsx)(n.br,{}),"\n","String or ",(0,t.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["Computes the file's CRC32 checksum on the controller.",(0,t.jsx)(n.br,{}),"\n","Useful for quick integrity verification."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local crc32, err = LCC.web_file.crc32("/firmware/patch.bin")\nif crc32 then\n    print("CRC32=" .. crc32)\nend\n'})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>c,x:()=>s});var l=r(6540);const t={},i=l.createContext(t);function c(e){const n=l.useContext(i);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:c(e.components),l.createElement(i.Provider,{value:n},e.children)}}}]);