File I/O
File paths resolve against the process working directory. read(path, true) forces raw text; the default dispatches by extension. Missing files currently return null with a warning.
| Extension | Default reader / boundary |
|---|---|
.csv / .tsv | CSV parser; list of row dictionaries, first row as headers. TSV uses a tab delimiter. |
.json | JSON value; not restricted to dictionaries/lists. |
.jsonl | Currently routed to the single JSON parser; not a dedicated line-by-line JSONL reader. |
.docx / .xlsx | Native Office ZIP/XML readers; text or rows. Legacy .doc/.xls binary support is not guaranteed by extension detection. |
.pdf | Native PDF text reader. |
| Other ordinary text files | Text content. |
Additional filesystem calls include file->mkdir(path), rmdir(path), ls(path), exists(path), delete(path). Calls use host permissions; there is no filesystem sandbox.
CSV
Use parse(text, delimiter=",", header=true), stringify(rows, delimiter=",") and write(path, rows). Choose a non-empty delimiter. Fields use the reader’s current numeric/boolean/text conversion rules.
JSON
Use parse(text), stringify(value, indent=0), and write(path, value, indent=2). This older parser is distinct from the stricter HTTP JSON decoder; do not assume identical malformed-input behavior.
The native reader has separate text and image paths. It is not MuPDF and does not guarantee extraction from every PDF. These examples require a readable report.pdf in the working directory.
Text extraction
Image extraction
| Field | Meaning |
|---|---|
text, pages | Extracted text (or a no-extractable-text marker) and page count. |
pages_content | List of dictionaries with number and text. |
images | List with index, format, width, height, page and base64 data. |
DOCX
Reads text from supported Word ZIP/XML documents. It does not preserve a complete Word layout, macros or embedded-object model. Supply report.docx to run this example.
XLSX
Reads supported workbook content into row dictionaries. Worksheet, formula, style and type coverage is limited to the native reader; this is not a full Excel calculation engine. Supply records.xlsx to run this example.