"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8845],{3521:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});const l=JSON.parse('{"id":"XXTLanControl.lua/web-file/appends","title":"Append To Controller File (LCC.web_file.appends)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/appends.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/appends","permalink":"/docs/en/XXTLanControl.lua/web-file/appends","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":110,"frontMatter":{"sidebar_position":110},"sidebar":"tutorialSidebar","previous":{"title":"Overwrite Controller File Content (LCC.web_file.writes)","permalink":"/docs/en/XXTLanControl.lua/web-file/writes"},"next":{"title":"Download Controller File To Device (LCC.web_file.download_file)","permalink":"/docs/en/XXTLanControl.lua/web-file/download_file"}}');var t=r(4848),o=r(8453);const i={sidebar_position:110},s="Append To Controller File (LCC.web_file.appends)",a={},d=[{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 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,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"append-to-controller-file-lccweb_fileappends",children:"Append To Controller File (LCC.web_file.appends)"})}),"\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:"ok, err = LCC.web_file.appends(path, data, 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 path to append."]}),"\n",(0,t.jsxs)(n.li,{children:["data",(0,t.jsx)(n.br,{}),"\n","String. Content to append."]}),"\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:["ok",(0,t.jsx)(n.br,{}),"\n","Boolean. ",(0,t.jsx)(n.code,{children:"true"})," on success, ",(0,t.jsx)(n.code,{children:"false"})," 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 operation 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:["Appends data to the end of the file.",(0,t.jsx)(n.br,{}),"\n","Missing parent directories and the target file are created automatically.",(0,t.jsx)(n.br,{}),"\n","Useful for continuously extending logs or export records."]}),"\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 ok, err = LCC.web_file.appends("/logs/task.log", "Finished at 2024-01-01\\n")\nif not ok then\n    LCC.log(3, "Append failed", err)\nend\n'})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>s});var l=r(6540);const t={},o=l.createContext(t);function i(e){const n=l.useContext(o);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:i(e.components),l.createElement(o.Provider,{value:n},e.children)}}}]);