Appifio Creator · Lesson EM05 · Easy · 7 page-file / upload methods

Site page files & upload
full methods - params · returns · notes

Different from the JSON store (EM03). Easy: upload does not require admin login (only a page session key) - be careful with public forms.

Quick compare: Data store on first run → success + empty · Missing page file → usually success: false.
appifio_readFsFile(filePath)

Job: Read a page file (HTML/CSS/JS/JSON…) or binary (base64).

const r = await appifio_client.appifio_readFsFile('routes.json');
if (r.success) {
  const routes = JSON.parse(r.data.content); // text JSON → parse yourself
}
// HTML: use r.data.content directly (string)

Returns: { data: { content, … } }. Binary may include encoding. Missing path → success: false.

appifio_writeFsFile(filePath, content)

Params: relative path in the site + content string (html, css, js, json…).

await appifio_client.appifio_writeFsFile('blog/detail.html', htmlString);
await appifio_client.appifio_writeFsFile('backend/functions/greetUser.js', code);

Returns: { success: true, data?: { path, size } }. Don’t use for dangerous executable extensions (system rejects them).

appifio_deleteFsFile(filePath)
await appifio_client.appifio_deleteFsFile('blog/old.html');

Notes: Don’t “wipe” routes.json by hand to remove one URL - use removeRoute (EM06).

appifio_listFsFiles(subfolder?, pattern?)

Easy params: subfolder (default ''), pattern (default '').

const r = await appifio_client.appifio_listFsFiles('blog', '*.html');

Unlike Aura: Aura often takes an options object { path, recursive } - Easy uses two strings.

appifio_getFsFileInfo(filePath)
const r = await appifio_client.appifio_getFsFileInfo('routes.json');
// data: path, name, size, …
appifio_uploadImage(file)

Params: a File from an input - jpg/png/gif/webp/svg… · max ~10MB.

const r = await appifio_client.appifio_uploadImage(input.files[0]);
const url = r.data.url; // set  or save into a JSON notebook

Returns: { data: { url: "…" } }. Aura: usually requires admin login.

appifio_uploadFile(file)

Params: documents (pdf, zip…) · max ~50MB (per system limits).

const r = await appifio_client.appifio_uploadFile(input.files[0]);
// r.data.url
EM05 checklist (7/7): readFsFile · writeFsFile · deleteFsFile · listFsFiles · getFsFileInfo · uploadImage · uploadFile

Next

EM06 - Routes (full methods)

Appifio Creator · User guide · EM05