"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[6231],{4871:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>t,metadata:()=>l,toc:()=>d});const l=JSON.parse('{"id":"XXTLanControl.lua/web-file/size","title":"\u83b7\u53d6\u8def\u5f84\u5c3a\u5bf8 (LCC.web_file.size)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/web-file/size.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/size","permalink":"/docs/XXTLanControl.lua/web-file/size","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":50,"frontMatter":{"sidebar_position":50},"sidebar":"tutorialSidebar","previous":{"title":"\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728 (LCC.web_file.exists)","permalink":"/docs/XXTLanControl.lua/web-file/exists"},"next":{"title":"\u8ba1\u7b97\u6587\u4ef6 MD5 (LCC.web_file.md5)","permalink":"/docs/XXTLanControl.lua/web-file/md5"}}');var s=i(4848),r=i(8453);const t={sidebar_position:50},o="\u83b7\u53d6\u8def\u5f84\u5c3a\u5bf8 (LCC.web_file.size)",c={},d=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",level:2}];function a(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:"\u83b7\u53d6\u8def\u5f84\u5c3a\u5bf8-lccweb_filesize",children:"\u83b7\u53d6\u8def\u5f84\u5c3a\u5bf8 (LCC.web_file.size)"})}),"\n",(0,s.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\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:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["path",(0,s.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u5f85\u67e5\u8be2\u7684\u6587\u4ef6\u8def\u5f84"]}),"\n",(0,s.jsxs)(n.li,{children:["timeout",(0,s.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,s.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["size",(0,s.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u76ee\u6807\u5b58\u5728\u65f6\u8fd4\u56de\u5c3a\u5bf8\uff1b\u5426\u5219\u4e3a ",(0,s.jsx)(n.code,{children:"nil"})]}),"\n",(0,s.jsxs)(n.li,{children:["err",(0,s.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,s.jsx)(n.code,{children:"nil"}),"\uff0c\u672a\u80fd\u83b7\u53d6\u5230\u5c3a\u5bf8\u65f6\u56fa\u5b9a\u4e3a ",(0,s.jsx)(n.code,{children:"'not found'"})]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["\u901a\u8fc7\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728\u6765\u83b7\u53d6\u5c3a\u5bf8\u3002",(0,s.jsx)(n.br,{}),"\n","\u666e\u901a\u6587\u4ef6\u8fd4\u56de\u5b57\u8282\u6570\uff1b\u76ee\u5f55\u5f53\u524d\u8fd4\u56de ",(0,s.jsx)(n.code,{children:"0"}),"\u3002",(0,s.jsx)(n.br,{}),"\n","\u672a\u80fd\u83b7\u53d6\u5230\u5c3a\u5bf8\u65f6\uff0c\u7edf\u4e00\u8fd4\u56de ",(0,s.jsx)(n.code,{children:"nil, 'not found'"}),"\u3002"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:'local size, err = LCC.web_file.size("/\u62a5\u544a/log.txt")\nif size then\n    print("\u65e5\u5fd7\u5927\u5c0f: " .. 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)(a,{...e})}):a(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>t,x:()=>o});var l=i(6540);const s={},r=l.createContext(s);function t(e){const n=l.useContext(r);return l.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:t(e.components),l.createElement(r.Provider,{value:n},e.children)}}}]);