greenServeFEgreenServeFE

Documentation home / Native Module API

Native Module API

Text File Operations

Check file existence, read/write/append text and inspect file size.

Purpose

Check file existence, read/write/append text and inspect file size.

Exports registered by the module initializer

ExportRole
existsexists helper
read_textread text helper
write_textwrite text helper
append_textappend text helper
sizesize helper

Usage

import gs_file;
define path = "/tmp/gsfe-note.txt";
gs_file.write_text(path, "hello\n");
gs_file.append_text(path, "second line\n");
print(gs_file.read_text(path));
print(gs_file.size(path));
Uses operating-system permissions of the greenServeFE process. This module is not a sandbox; never pass untrusted paths without validation.

Related: Module catalog · Native ABI · Language guide.