"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[5810],{194:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/size","title":"Get Path Size (LCC.web_file.size)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/size.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/size","permalink":"/docs/en/XXTLanControl.lua/web-file/size","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":50,"frontMatter":{"sidebar_position":50},"sidebar":"tutorialSidebar","previous":{"title":"Check Path Existence (LCC.web_file.exists)","permalink":"/docs/en/XXTLanControl.lua/web-file/exists"},"next":{"title":"Calculate File MD5 (LCC.web_file.md5)","permalink":"/docs/en/XXTLanControl.lua/web-file/md5"}}');var s=t(4848),r=t(8453);const l={sidebar_position:50},o="Get Path Size (LCC.web_file.size)",a={},c=[{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 d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"get-path-size-lccweb_filesize",children:"Get Path Size (LCC.web_file.size)"})}),"\n",(0,s.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"size, err = LCC.web_file.size(path, timeout?)\n"})}),"\n",(0,s.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["path",(0,s.jsx)(n.br,{}),"\n","String. File to inspect."]}),"\n",(0,s.jsxs)(n.li,{children:["timeout",(0,s.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,s.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["size",(0,s.jsx)(n.br,{}),"\n","Number. Size when the path exists; ",(0,s.jsx)(n.code,{children:"nil"})," otherwise."]}),"\n",(0,s.jsxs)(n.li,{children:["err",(0,s.jsx)(n.br,{}),"\n","String or ",(0,s.jsx)(n.code,{children:"nil"}),". Returns ",(0,s.jsx)(n.code,{children:"'not found'"})," when the size cannot be determined."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["Retrieves the size by checking whether the path exists.",(0,s.jsx)(n.br,{}),"\n","Regular files return their byte size; directories currently return ",(0,s.jsx)(n.code,{children:"0"}),".",(0,s.jsx)(n.br,{}),"\n","Returns ",(0,s.jsx)(n.code,{children:"nil, 'not found'"})," whenever the size cannot be determined."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:'local size, err = LCC.web_file.size("/reports/log.txt")\nif size then\n    print("Log size: " .. size .. " bytes")\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>o});var i=t(6540);const s={},r=i.createContext(s);function l(e){const n=i.useContext(r);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);