"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[4360],{4350:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/copy_overwrite","title":"Copy And Overwrite (LCC.web_file.copy_overwrite)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/copy_overwrite.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/copy_overwrite","permalink":"/docs/en/XXTLanControl.lua/web-file/copy_overwrite","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":260,"frontMatter":{"sidebar_position":260},"sidebar":"tutorialSidebar","previous":{"title":"Copy Files Or Directories (LCC.web_file.copy)","permalink":"/docs/en/XXTLanControl.lua/web-file/copy"},"next":{"title":"Copy And Merge Missing Items (LCC.web_file.copy_merge)","permalink":"/docs/en/XXTLanControl.lua/web-file/copy_merge"}}');var o=n(4848),t=n(8453);const s={sidebar_position:260},l="Copy And Overwrite (LCC.web_file.copy_overwrite)",c={},a=[{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 r={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.header,{children:(0,o.jsx)(r.h1,{id:"copy-and-overwrite-lccweb_filecopy_overwrite",children:"Copy And Overwrite (LCC.web_file.copy_overwrite)"})}),"\n",(0,o.jsx)(r.h2,{id:"signature",children:"Signature"}),"\n",(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-lua",children:"ok, err = LCC.web_file.copy_overwrite(src, target, timeout?)\n"})}),"\n",(0,o.jsx)(r.h2,{id:"parameters",children:"Parameters"}),"\n",(0,o.jsxs)(r.ul,{children:["\n",(0,o.jsxs)(r.li,{children:["src",(0,o.jsx)(r.br,{}),"\n","String. Source path."]}),"\n",(0,o.jsxs)(r.li,{children:["target",(0,o.jsx)(r.br,{}),"\n","String. Destination path."]}),"\n",(0,o.jsxs)(r.li,{children:["timeout",(0,o.jsx)(r.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,o.jsx)(r.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,o.jsx)(r.h2,{id:"returns",children:"Returns"}),"\n",(0,o.jsxs)(r.ul,{children:["\n",(0,o.jsxs)(r.li,{children:["ok",(0,o.jsx)(r.br,{}),"\n","Boolean. ",(0,o.jsx)(r.code,{children:"true"})," on success, ",(0,o.jsx)(r.code,{children:"nil"})," on failure."]}),"\n",(0,o.jsxs)(r.li,{children:["err",(0,o.jsx)(r.br,{}),"\n","String or ",(0,o.jsx)(r.code,{children:"nil"}),". Error description when the copy fails."]}),"\n"]}),"\n",(0,o.jsx)(r.h2,{id:"notes",children:"Notes"}),"\n",(0,o.jsxs)(r.blockquote,{children:["\n",(0,o.jsxs)(r.p,{children:["Convenience wrapper around ",(0,o.jsx)(r.code,{children:"web_file.copy"})," with ",(0,o.jsx)(r.code,{children:'mode = "overwrite"'}),".",(0,o.jsx)(r.br,{}),"\n","Existing targets are deleted before copying."]}),"\n"]}),"\n",(0,o.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-lua",children:'local ok, err = LCC.web_file.copy_overwrite("/scripts", "/deploy/scripts")\nif not ok then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:r}={...(0,t.R)(),...e.components};return r?(0,o.jsx)(r,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>s,x:()=>l});var i=n(6540);const o={},t=i.createContext(o);function s(e){const r=i.useContext(t);return i.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),i.createElement(t.Provider,{value:r},e.children)}}}]);