This repo ships the full offline viewer as a Node-served app and keeps the original offline build untouched for reference.
- Node web app:
server.jshosts the FTIR viewer frompublic/(copied fromoffline/) and exposes APIs for merging and persisting sessions. - CLI:
convert.jsmerges all.txtin a folder intowavenumber+ one column per file. - Legacy offline: unchanged copy in
offline/if you want to open the app directly from disk.
Node.js 18+
This project uses only built-in Node APIs—no npm install is required.
node server.jsWhat you get in the UI:
- Multi-file upload (.txt, JCAMP variants), chart with zone highlights, per-series visibility + Y offsets, baseline preview, stripes/peaks table, PNG/SVG copy, session export/import.
- Configurable X/Y ranges; translations EN/RU/SR; footer links configured in
public/config.js. - CSV export currently happens client-side;
/merge//api/mergealso save server copies togenerated/.
Server endpoints:
POST /merge→ accepts{ name, files:[{name,content}] }, returns CSV download (attachment). Saves a copy togenerated/<name>.csv.POST /api/merge→ same payload, responds JSON{ fileName, totalRows, csvPath }after saving CSV.POST /api/sessions→ body is your session object (anything the UI wants to persist). Saves togenerated/sessions/<id>.json, responds{ id, savedAt }.GET /api/sessions/:id→ returns previously saved session JSON.- Static assets are served from
public/; generated CSVs are downloadable under/generated/<file>.csv.
How to use the UI:
- Open
http://localhost:3000. - Click the upload icon to add spectra; supported:
.txt,.jdx/.dx/.jcm/.jsm. - Adjust X/Y ranges, toggle series in the legend, set Y offsets per series.
- Place a marker on the chart, add stripes/peaks, and copy the table if needed.
- Export/import sessions (JSON) for state portability; copy chart as PNG/SVG; save CSV (visible series only).
- Translations switch in the header; footer links come from
public/config.js.
server.js: minimal HTTP server. Serves static assets frompublic/, streams generated CSVs fromgenerated/, and exposes JSON APIs:POST /merge→ download CSV (for browsers).POST /api/merge→ JSON{ fileName, totalRows, csvPath }after saving merged CSV.POST /api/sessions→ persist a session JSON togenerated/sessions/<id>.json, responds with{ id, savedAt }.GET /api/sessions/:id→ read a previously saved session.
public/: Node-served version of the offline viewer (copied fromoffline/), uses D3 +jcampconverterandpeak-db.jsfor tips.generated/: runtime output (CSV exports and saved sessions); safe to delete/regenerate.offline/: original offline drop-in kept intact for comparison or air-gapped use.
Future server extensions (collab, server-side session storage, auth) can hook into /api/sessions and extend server.js without touching offline/.
# default: reads ./example, writes merged.csv
node convert.js
# custom input folder and output file
node convert.js path/to/folder output.csvOutput format: wavenumber + %T columns per file (column name = sanitized file name without extension).
CLI details:
- Input must be plain text files with
wavenumber valuepairs per line (whitespace-separated). - Sorting: output is sorted descending by wavenumber (4000 → 500 style).
- Column naming: derived from the file name; duplicates get
_1,_2, etc.
cd electron-app
npm install
npm startAlready configured in electron-app/package.json using electron-builder.
cd electron-app
# if PowerShell blocks scripts: run in cmd.exe or use `npm.cmd` / `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass`
npm install
npm run distArtifacts will appear in electron-app/dist/ (NSIS installer by default). To make a portable exe instead of installer, change "target": "portable" under "win" in package.json.
See example/ for source .txt files and the reference example/merged.csv.