# fmptools for the web (johnmcm.com) The WebAssembly module behind johnmcm.com's FileMaker Viewer (/filemaker-viewer): [fmptools](https://github.com/evanmiller/fmptools) by Evan Miller (MIT), version 0.2.3 at commit `fd32a6c4f425a377f27efd558cf9bc7cc09985a6`, which reads FileMaker Pro .fp3, .fp5, .fp7 and .fmp12 files. Only the reader library is built (block.c, fmp.c, scsu.c, list_tables.c, list_columns.c, read_values.c and dump_file.c, unmodified); its command-line converters, and so libxlsxwriter, yajl and SQLite, are not. The page writes Excel, CSV and JSON itself. Two files of this site's own sit beside it: - `src/wrapper.c`: a few plain C functions (no embind, so no `Function()` in the glue): copy a file in, open it from memory with `fmp_open_buffer`, list the tables and their fields as JSON, and read a table's values into one buffer of (row, field, length, UTF-8 bytes) records. For .fmp12 container fields, `fm_pool` lists every table's object pool ([128+table].[31].[5].[n]: each object's stream directory, stored name, MAIN/SIZE values, and where each stream's parts are) without their bytes, and `fm_stream` reads one stream's parts from the blocks that hold them, through fmptools' own block and chunk reader. The page (containers.ts) decodes these. - `src/macroman.c`: `iconv_open`, `iconv` and `iconv_close` for the one conversion fmptools asks for, MacRoman to UTF-8 (the text of .fp3 and .fp5 files). Emscripten's musl iconv has no MacRoman table, so without it those files would not open. The table is glibc's, so the text matches what the fmptools tools give on Linux. `Dockerfile` builds it with the Emscripten image pinned by digest; run `build.ps1` with Docker Desktop running. The module goes to `frontend/vendor/local/fmptools@2/` (`@1`, without the container functions, stays for pages cached before it), the exact library sources built to `source/` (with fmptools' README, HACKING and LICENSE), and the licence to `LICENSE-fmptools.txt`, which stands for the built module, as it carries no notice of its own. Checked against fmptools' own `fmp2json`, built natively from the same commit: the same tables, fields, types, records and values on every file in fmptools' test/data (FileMaker Pro 3, 5, 7 and 12 files) and on this site's fixture (`smoke/fixtures/filemaker-sample.fp5`), and the same refusals (a damaged sector count) on the files fmp2json refuses. The container functions were checked on .fmp12 files saved by FileMaker with JPEG, PNG, TIFF (with FileMaker's JPEG preview), PDF (with its PNG preview) and OLE objects in container fields, several fields per record, and on this site's own `smoke/fixtures/filemaker-containers.fmp12` (`tests/fixtures/filemaker/make-fmp12.py`): every stored file came out whole (JPEGs end in FFD9, PNGs in IEND, PDFs in %%EOF; sizes as FileMaker recorded). Those FileMaker files are not ours to commit.