Сырое чтение и запись файлов в собственном каталоге плагина.file читает и пишет обычные файлы — байтовую строку целиком, без разбора
формата. Для структурированных данных (таблиц) есть store/datafile; file
для всего остального: csv-экспорт, готовый json, любой текстовый или бинарный
формат, который плагин собирает сам.
Все имена — только внутри plugin.data_dir(), той же папки, куда пишут
db.open() и store. Подпапок нет — name не может содержать /, \
или что-то похожее на путь.Имя — это stem или stem.ext:
stem: буквы, цифры, _, -
.ext — необязательно, ровно одна точка на всё имя, только буквы и цифры
Одно чтение или одна запись/дозапись — не больше 4 МиБ. Больше — nil и
причина, ещё до того, как файл открыт: частично записанного файла при отказе
не остаётся.
hook.add("player:death", "myplugin.kills_log", function(e) file.append("kills.csv", ("%s,%s\n"):format(e.attacker and e.attacker:name() or "world", e.player:name()))end)
Предел 4 МиБ — на один вызов, не на итоговый размер файла: у file.append
нет ограничения на то, насколько большим станет файл со временем. Для
самоограничивающегося лога с ротацией по дням — log.write.
{"docsConfig":{"theme":"palm","$schema":"https://mintlify.com/docs.json","name":"cs-lua","description":"Плагины для CS 1.6 на Lua вместо SourcePawn","colors":{"primary":"#b45309","light":"#f59e0b","dark":"#f59e0b"},"favicon":"https://mintcdn.com/cs-lua/4nz6nyrD_5HF1omW/favicon.svg?fit=max\u0026auto=format\u0026n=4nz6nyrD_5HF1omW\u0026q=85\u0026s=0c30c7ace5323904dec95fad5a12618f","styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cs-lua","hasAudioNarration":false,"actualSubdomain":"cs-lua","customDomains":[],"gitSource":{"type":"github","owner":"kotyarakryt","repo":"cs-lua","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"latestBuiltDeploymentHistoryId":"6a99652396830be73b3236c1","collectionId":"863c2317-eb88-4764-a474-a761c7d4f12b","liveDeploymentHistoryId":"6a99652396830be73b3236c1","schemaVersion":"v3"},"feedback":{"thumbs":true,"issues":true,"edits":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a99652396830be73b3236c1","clientVersion":"0.0.4071","searchFilterCounts":[{"language":"default","tag":"Справочник API","count":57},{"language":"default","tag":"hook","count":8},{"language":"default","tag":"players","count":8},{"language":"default","tag":"access","count":4},{"language":"default","tag":"db","count":4},{"language":"default","tag":"ents","count":3},{"language":"default","tag":"msg","count":3},{"language":"default","tag":"mysql","count":3},{"language":"default","tag":"store","count":3},{"language":"default","tag":"sv","count":3}],"searchSettings":{"isFiltersEnabled":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"type":"link","url":"https://github.com/KotyaraKryt/cs-lua/issues"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"privacy":{"consentBanner":{"enabled":true}},"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api/file","slug":"/api/file","pageMetadata":{"title":"file","description":"Сырое чтение и запись файлов в собственном каталоге плагина","href":"/api/file/index"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Сырое чтение и запись файлов в собственном каталоге плагина\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`file`,children:`file`}),`\n`,_jsx(_components.p,{children:`Сырое чтение и запись файлов в собственном каталоге плагина.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`file`}),` читает и пишет обычные файлы — байтовую строку целиком, без разбора\nформата. Для структурированных данных (таблиц) есть `,_jsx(_components.code,{children:`store`}),`/`,_jsx(_components.code,{children:`datafile`}),`; `,_jsx(_components.code,{children:`file`}),`\nдля всего остального: csv-экспорт, готовый json, любой текстовый или бинарный\nформат, который плагин собирает сам.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"name,score`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`player1,10`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`песочница`,children:`Песочница`}),`\n`,_jsxs(_components.p,{children:[`Все имена — только внутри `,_jsx(_components.code,{children:`plugin.data_dir()`}),`, той же папки, куда пишут\n`,_jsx(_components.code,{children:`db.open()`}),` и `,_jsx(_components.code,{children:`store`}),`. Подпапок нет — `,_jsx(_components.code,{children:`name`}),` не может содержать `,_jsx(_components.code,{children:`/`}),`, `,_jsx(_components.code,{children:`\\\\`}),`\nили что-то похожее на путь.`]}),`\n`,_jsxs(_components.p,{children:[`Имя — это `,_jsx(_components.code,{children:`stem`}),` или `,_jsx(_components.code,{children:`stem.ext`}),`:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`stem`}),`: буквы, цифры, `,_jsx(_components.code,{children:`_`}),`, `,_jsx(_components.code,{children:`-`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`.ext`}),` — необязательно, ровно одна точка на всё имя, только буквы и цифры`]}),`\n`,_jsx(_components.li,{children:`максимум 64 символа`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Валидно: `,_jsx(_components.code,{children:`report.csv`}),`, `,_jsx(_components.code,{children:`export_2026.json`}),`, `,_jsx(_components.code,{children:`state`}),`.\nНевалидно: `,_jsx(_components.code,{children:`../evil.txt`}),`, `,_jsx(_components.code,{children:`sub/dir.txt`}),`, `,_jsx(_components.code,{children:`a.b.c`}),`, `,_jsx(_components.code,{children:`.hidden`}),`, `,_jsx(_components.code,{children:`hidden.`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`предел-размера`,children:`Предел размера`}),`\n`,_jsxs(_components.p,{children:[`Одно чтение или одна запись/дозапись — не больше 4 МиБ. Больше — `,_jsx(_components.code,{children:`nil`}),` и\nпричина, ещё до того, как файл открыт: частично записанного файла при отказе\nне остаётся.`]}),`\n`,_jsx(Heading,{level:`2`,id:`read`,children:`file.read`}),`\n`,_jsx(_components.p,{children:`Читает содержимое файла целиком.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string | nil`})}),_jsx(_components.td,{children:`содержимое файла`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`причина, если файл не открылся, его нет или он больше 4 МиБ`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"не смог прочитать: \" `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`..`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Отсутствие файла — тоже ошибка здесь (`,_jsx(_components.code,{children:`nil, \"cannot open ...\"`}),`), в отличие от\n`,_jsx(_components.code,{children:`file.size`}),`, где отсутствие файла — просто `,_jsx(_components.code,{children:`nil`}),` без причины.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`смотри-также`,children:`Смотри также`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`index.md#size`,children:`file.size`})}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`write`,children:`file.write`}),`\n`,_jsx(_components.p,{children:`Перезаписывает файл целиком (или создаёт его).`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы-2`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`content`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`что записать, до 4 МиБ`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-2`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`boolean | nil`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),` при успехе`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`причина при ошибке`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-2`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"name,score`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"не смог записать: \" `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`..`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Для дозаписи в конец существующего файла — `,_jsx(_components.code,{children:`file.append`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`смотри-также-2`,children:`Смотри также`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`index.md#append`,children:`file.append`})}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`append`,children:`file.append`}),`\n`,_jsx(_components.p,{children:`Дописывает в конец файла, не трогая то, что уже было (или создаёт его).`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`append`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы-3`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`content`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`что дописать, до 4 МиБ за один вызов`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-3`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`boolean | nil`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),` при успехе`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`причина при ошибке`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-3`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`hook`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"player:death\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"myplugin.kills_log\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`append`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kills.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"%s,%s`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`format`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`attacker`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`attacker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`or`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"world\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`player`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Предел 4 МиБ — на один вызов, не на итоговый размер файла: у `,_jsx(_components.code,{children:`file.append`}),`\nнет ограничения на то, насколько большим станет файл со временем. Для\nсамоограничивающегося лога с ротацией по дням — `,_jsx(_components.a,{href:`/api/log`,children:_jsx(_components.code,{children:`log.write`})}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`exists`,children:`file.exists`}),`\n`,_jsx(_components.p,{children:`Проверяет, есть ли файл в каталоге плагина.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`exists`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы-4`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-4`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`boolean`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),`/`,_jsx(_components.code,{children:`false`}),`; неверное имя или отсутствие каталога плагина — тоже `,_jsx(_components.code,{children:`false`}),`, не ошибка`]})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-4`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`exists`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"config.json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"config.json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`remove`,children:`file.remove`}),`\n`,_jsx(_components.p,{children:`Удаляет файл из каталога плагина.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`remove`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы-5`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-5`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`boolean | nil`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),` при успехе`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`причина при ошибке, в том числе если файла и не было`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-5`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`remove`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tmp.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`size`,children:`file.size`}),`\n`,_jsx(_components.p,{children:`Возвращает размер файла в байтах.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`size`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`аргументы-6`,children:`Аргументы`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`имя`}),_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`name`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`имя файла в каталоге плагина (см. песочницу выше)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-6`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`number | nil`})}),_jsxs(_components.td,{children:[`размер в байтах; `,_jsx(_components.code,{children:`nil`}),` без причины, если файла нет, имя не годится или нет каталога плагина`]})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-6`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`size`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`remove`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report.csv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`смотри-также-3`,children:`Смотри также`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`index.md#read`,children:`file.read`})}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`list`,children:`file.list`}),`\n`,_jsx(_components.p,{children:`Возвращает имена всех файлов верхнего уровня в каталоге плагина.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`list`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`возвращает-7`,children:`Возвращает`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`тип`}),_jsx(_components.th,{})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`table`})}),_jsx(_components.td,{children:`массив имён файлов; пустой, если каталога плагина ещё нет`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`пример-7`,children:`Пример`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` _`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` ipairs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`list`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Подпапка `,_jsx(_components.code,{children:`logs/`}),`, которую создаёт `,_jsx(_components.a,{href:`/api/log`,children:_jsx(_components.code,{children:`log.write`})}),`, в список не\nпопадает — это отдельное хранилище, не файлы плагина.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"file","description":"Сырое чтение и запись файлов в собственном каталоге плагина","href":"/api/file/index"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"file","slug":"file","depth":1,"children":[]},{"title":"Песочница","slug":"песочница","depth":2,"children":[]},{"title":"Предел размера","slug":"предел-размера","depth":2,"children":[]},{"title":"file.read","slug":"read","depth":2,"children":[{"title":"Аргументы","slug":"аргументы","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает","depth":3,"children":[]},{"title":"Пример","slug":"пример","depth":3,"children":[]},{"title":"Смотри также","slug":"смотри-также","depth":3,"children":[]}]},{"title":"file.write","slug":"write","depth":2,"children":[{"title":"Аргументы","slug":"аргументы-2","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает-2","depth":3,"children":[]},{"title":"Пример","slug":"пример-2","depth":3,"children":[]},{"title":"Смотри также","slug":"смотри-также-2","depth":3,"children":[]}]},{"title":"file.append","slug":"append","depth":2,"children":[{"title":"Аргументы","slug":"аргументы-3","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает-3","depth":3,"children":[]},{"title":"Пример","slug":"пример-3","depth":3,"children":[]}]},{"title":"file.exists","slug":"exists","depth":2,"children":[{"title":"Аргументы","slug":"аргументы-4","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает-4","depth":3,"children":[]},{"title":"Пример","slug":"пример-4","depth":3,"children":[]}]},{"title":"file.remove","slug":"remove","depth":2,"children":[{"title":"Аргументы","slug":"аргументы-5","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает-5","depth":3,"children":[]},{"title":"Пример","slug":"пример-5","depth":3,"children":[]}]},{"title":"file.size","slug":"size","depth":2,"children":[{"title":"Аргументы","slug":"аргументы-6","depth":3,"children":[]},{"title":"Возвращает","slug":"возвращает-6","depth":3,"children":[]},{"title":"Пример","slug":"пример-6","depth":3,"children":[]},{"title":"Смотри также","slug":"смотри-также-3","depth":3,"children":[]}]},{"title":"file.list","slug":"list","depth":2,"children":[{"title":"Возвращает","slug":"возвращает-7","depth":3,"children":[]},{"title":"Пример","slug":"пример-7","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cs-lua","siteName":"cs-lua","title":"file - cs-lua","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-20T06:46:53.217Z","originalFileLocation":"api/file/index.md"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Сырое чтение и запись файлов в собственном каталоге плагина\">\u003cmeta data-mint-head name=\"application-name\" content=\"cs-lua\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"file - cs-lua\">\u003cmeta data-mint-head property=\"og:description\" content=\"Сырое чтение и запись файлов в собственном каталоге плагина\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"cs-lua\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cs-lua.mintlify.app/api/file\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cs-lua.mintlify.app/_mintlify/api/og/v2?division=file\u0026amp;title=file\u0026amp;description=%D0%A1%D1%8B%D1%80%D0%BE%D0%B5+%D1%87%D1%82%D0%B5%D0%BD%D0%B8%D0%B5+%D0%B8+%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C+%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%B2+%D0%B2+%D1%81%D0%BE%D0%B1%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%BC+%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3%D0%B5+%D0%BF%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD%D0%B0\u0026amp;theme=b6c4e23cd1a333c2e21535c9\u0026amp;signature=3798200c771a1cab3f002e09ca30c32755c85b4c870c6c9fd7930f87c23ea720\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"file - cs-lua\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Сырое чтение и запись файлов в собственном каталоге плагина\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cs-lua.mintlify.app/_mintlify/api/og/v2?division=file\u0026amp;title=file\u0026amp;description=%D0%A1%D1%8B%D1%80%D0%BE%D0%B5+%D1%87%D1%82%D0%B5%D0%BD%D0%B8%D0%B5+%D0%B8+%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C+%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%B2+%D0%B2+%D1%81%D0%BE%D0%B1%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%BC+%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3%D0%B5+%D0%BF%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD%D0%B0\u0026amp;theme=b6c4e23cd1a333c2e21535c9\u0026amp;signature=3798200c771a1cab3f002e09ca30c32755c85b4c870c6c9fd7930f87c23ea720\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cs-lua/I_ekpo-jh1KbG7rl/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"cs-lua\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#b45309\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cs-lua.mintlify.app/api/file\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api/file.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://cs-lua.mintlify.app/#organization\",\"name\":\"cs-lua\",\"url\":\"https://cs-lua.mintlify.app\"},{\"@type\":\"WebSite\",\"@id\":\"https://cs-lua.mintlify.app#website\",\"name\":\"cs-lua\",\"url\":\"https://cs-lua.mintlify.app\",\"publisher\":{\"@id\":\"https://cs-lua.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://cs-lua.mintlify.app/api/file#webpage\",\"url\":\"https://cs-lua.mintlify.app/api/file\",\"name\":\"file\",\"description\":\"Сырое чтение и запись файлов в собственном каталоге плагина\",\"dateModified\":\"2026-08-20T06:46:53.217Z\",\"isPartOf\":{\"@id\":\"https://cs-lua.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://cs-lua.mintlify.app/api/file#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://cs-lua.mintlify.app/api/file#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Справочник API\",\"item\":\"https://cs-lua.mintlify.app/api/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"file\",\"item\":\"https://cs-lua.mintlify.app/api/file/index\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"file\",\"item\":\"https://cs-lua.mintlify.app/api/file\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://cs-lua.mintlify.app/api/file#article\",\"headline\":\"file\",\"name\":\"file\",\"description\":\"Сырое чтение и запись файлов в собственном каталоге плагина\",\"url\":\"https://cs-lua.mintlify.app/api/file\",\"mainEntityOfPage\":{\"@id\":\"https://cs-lua.mintlify.app/api/file#webpage\"},\"dateModified\":\"2026-08-20T06:46:53.217Z\",\"publisher\":{\"@id\":\"https://cs-lua.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://cs-lua.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"cs-lua\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"cs-lua","nav":{"global":null,"groups":[{"group":"Документация","pages":[{"title":null,"href":"/intro"},{"title":null,"href":"/install"},{"title":"Plugins","href":"/plugins"},{"title":null,"href":"/building"}]},{"group":"Справочник API","pages":[{"title":null,"href":"/api/index"},{"group":"hook","pages":[{"title":"hook","href":"/api/hook/index"},{"title":"hook — Пространство имён","href":"/api/hook/namespace"},{"title":"hook — Подключение","href":"/api/hook/connection"},{"title":"hook — Жизнь сервера","href":"/api/hook/lifecycle"},{"title":"hook — Геймплей","href":"/api/hook/gameplay"},{"title":"hook — Раунд и бомба","href":"/api/hook/round"},{"title":"hook — Магазин","href":"/api/hook/shop"},{"title":"hook — Движок и ReHLDS","href":"/api/hook/engine"}]},{"group":"msg","pages":[{"title":"msg","href":"/api/msg/index"},{"title":"msg — Отправка","href":"/api/msg/send"},{"title":"msg — Поля сообщения","href":"/api/msg/fields"}]},{"group":"cmd","pages":[{"title":"cmd","href":"/api/cmd/index"}]},{"group":"players","pages":[{"title":"players","href":"/api/players/index"},{"title":"players — Пространство имён","href":"/api/players/namespace"},{"title":"players — Идентификация","href":"/api/players/identity"},{"title":"players — Состояние","href":"/api/players/state"},{"title":"players — CS-состояние","href":"/api/players/cs-state"},{"title":"players — Сообщения","href":"/api/players/messages"},{"title":"players — Админские действия","href":"/api/players/admin"},{"title":"players — Права","href":"/api/players/access"}]},{"group":"timer","pages":[{"title":"timer","href":"/api/timer/index"},{"title":"timer — Анонимные","href":"/api/timer/anonymous"},{"title":"timer — Именованные","href":"/api/timer/named"}]},{"group":"ents","pages":[{"title":"ents","href":"/api/ents/index"},{"title":"ents — Пространство имён","href":"/api/ents/namespace"},{"title":"ents — Объект сущности","href":"/api/ents/entity"}]},{"group":"vec","pages":[{"title":"vec","href":"/api/vec/index"}]},{"group":"fx","pages":[{"title":"fx","href":"/api/fx/index"}]},{"group":"res","pages":[{"title":"res","href":"/api/res/index"}]},{"group":"sv","pages":[{"title":"sv","href":"/api/sv/index"},{"title":"sv — Сервер","href":"/api/sv/server"},{"title":"sv — Cvar","href":"/api/sv/cvar"}]},{"group":"db","pages":[{"title":"db","href":"/api/db/index"},{"title":"db — Открытие","href":"/api/db/open"},{"title":"db — Объект базы","href":"/api/db/database"},{"title":"db — Подготовленное выражение","href":"/api/db/statement"}]},{"group":"mysql","pages":[{"title":"mysql","href":"/api/mysql/index"},{"title":"mysql — Открытие","href":"/api/mysql/open"},{"title":"mysql — Объект соединения","href":"/api/mysql/connection"}]},{"group":"store","pages":[{"title":"store","href":"/api/store/index"},{"title":"store — Ключ-значение","href":"/api/store/kv"},{"title":"store — datafile","description":"Чтение и запись `.lua`-файлов. Формат читаемый и правится руками, поэтому","href":"/api/store/datafile"}]},{"group":"file","pages":[{"title":"file","href":"/api/file/index"}]},{"group":"log","pages":[{"title":"log","description":"Один лог-файл на плагин с автоматической ротацией по дням","href":"/api/log/index"}]},{"group":"regex","pages":[{"title":"regex","href":"/api/regex/index"}]},{"group":"http","pages":[{"title":"http","href":"/api/http/index"}]},{"group":"menu","pages":[{"title":"menu","href":"/api/menu/index"}]},{"group":"ui","pages":[{"title":"ui","href":"/api/ui/index"}]},{"group":"access","pages":[{"title":"access","href":"/api/access/index"},{"title":"access — Объявление","href":"/api/access/declare"},{"title":"access — Выдача","href":"/api/access/grant"},{"title":"access — Чтение","href":"/api/access/read"}]},{"group":"plugin","pages":[{"title":"plugin","href":"/api/plugin/index"}]},{"group":"export / import","pages":[{"title":"export / import","href":"/api/exports/index"}]},{"title":"Все вызовы","href":"/api/all"},{"title":null,"href":"/api/console"}]}]},"basePath":"","title":"file - cs-lua","buildId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","deploymentId":"dpl_GZsjphRpnhWkstV12jxWNcMHFyox","dynamics":[],"chunks":[]}