Tutorials > A settings page that saves config > Files PLUGIN.JS (1/3) CrossPoint.registerPlugin(async (container, api) => { // ---------- helpers ---------- const $ = (s) => container.querySelector(s); const b64 = (text) => { let bin = ''; for (const byte of new TextEncoder().encode(text)) bin += String.fromCharCode(byte); return btoa(bin); }; const CONFIG = 'config.json'; async function readConfig() { try { const r = await fetch(api.pluginFile(CONFIG)); // 404 before the first save return r.ok ? await r.json() : {}; } catch (e) { return {}; } } async function writeConfig(cfg) { // config.json must stay FLAT (strings/whole numbers) and under 2 KB, // because the device reads it as {cfg.KEY} values. const json = JSON.stringify(cfg); if (json.length > 2000) throw new Error('config too large'); await api.writeFile(api.dir + '/' + CONFIG, b64(json)); } // ---------- UI ---------- const row = (label, input) => `