"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[4514],{5263:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>d,contentTitle:()=>t,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/download_file","title":"\u4e0b\u8f7d\u4e2d\u63a7\u6587\u4ef6\u5230\u8bbe\u5907 (LCC.web_file.download_file)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/web-file/download_file.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/download_file","permalink":"/docs/XXTLanControl.lua/web-file/download_file","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":120,"frontMatter":{"sidebar_position":120},"sidebar":"tutorialSidebar","previous":{"title":"\u8ffd\u52a0\u5199\u5165\u4e2d\u63a7\u6587\u4ef6 (LCC.web_file.appends)","permalink":"/docs/XXTLanControl.lua/web-file/appends"},"next":{"title":"\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7 (LCC.web_file.upload_file)","permalink":"/docs/XXTLanControl.lua/web-file/upload_file"}}');var o=l(4848),r=l(8453);const s={sidebar_position:120},t="\u4e0b\u8f7d\u4e2d\u63a7\u6587\u4ef6\u5230\u8bbe\u5907 (LCC.web_file.download_file)",d={},a=[{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 c(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,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"\u4e0b\u8f7d\u4e2d\u63a7\u6587\u4ef6\u5230\u8bbe\u5907-lccweb_filedownload_file",children:"\u4e0b\u8f7d\u4e2d\u63a7\u6587\u4ef6\u5230\u8bbe\u5907 (LCC.web_file.download_file)"})}),"\n",(0,o.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:"ok, err = LCC.web_file.download_file(path, target_path, timeout?)\n"})}),"\n",(0,o.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["path",(0,o.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u4e2d\u63a7\u7aef\u6e90\u6587\u4ef6\u8def\u5f84"]}),"\n",(0,o.jsxs)(n.li,{children:["target_path",(0,o.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8bbe\u5907\u7aef\u4fdd\u5b58\u8def\u5f84\uff08\u7edd\u5bf9\u8def\u5f84\uff09"]}),"\n",(0,o.jsxs)(n.li,{children:["timeout",(0,o.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,o.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["ok",(0,o.jsx)(n.br,{}),"\n","\u5e03\u5c14\u578b\uff0c\u4e0b\u8f7d\u6210\u529f\u8fd4\u56de ",(0,o.jsx)(n.code,{children:"true"}),"\uff0c\u5931\u8d25\u8fd4\u56de ",(0,o.jsx)(n.code,{children:"false"})]}),"\n",(0,o.jsxs)(n.li,{children:["err",(0,o.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,o.jsx)(n.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0"]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsxs)(n.p,{children:["\u4ece\u4e2d\u63a7\u4e0b\u8f7d\u6587\u4ef6\u5e76\u4fdd\u5b58\u5230\u8bbe\u5907\u6307\u5b9a\u8def\u5f84\u3002",(0,o.jsx)(n.br,{}),"\n","\u76ee\u5f55\u4e0d\u5b58\u5728\u6216\u5199\u5165\u5931\u8d25\u65f6\u8fd4\u56de ",(0,o.jsx)(n.code,{children:"false"})," \u5e76\u9644\u5e26\u9519\u8bef\u8bf4\u660e\u3002"]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'local ok, err = LCC.web_file.download_file("/\u811a\u672c/main.lua", XXT_SCRIPTS_PATH.."/cache.lua")\nif not ok then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>s,x:()=>t});var i=l(6540);const o={},r=i.createContext(o);function s(e){const n=i.useContext(r);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);