Toolkit overview
epanet-js contains two classes, Workspace & Project. A Workspace represents a virtual file system where you can store and read files that are consumed by the toolkit, such as INP Files or generated by it, such as RPT files or OUT files. The Workspace also owns the WebAssembly EPANET engine and decides which version of the engine your code will run against.
Since 0.9.0, every release of epanet-js ships binaries for multiple EPANET versions (v2.2, v2.3.0 – v2.3.5, plus master and dev snapshots), with optional EPANET-MSX support for multi-species water quality simulation. You can pick which engine you want at load time. See Workspace for the standard vs. slim loaders and the full list of engine variants.
A Project is a single instance of the EN_Project wrapper. It exposes the EPANET toolkit API methods. Which methods are actually wired up depends on the engine version loaded into the workspace; each function on the project functions pages is labelled with a version badge showing where it is available. All method names have been converted to camelCase to keep with JavaScript convention
Create a Project by instancing the Project class with a Workspace object:
import { Project, Workspace } from "epanet-js";
const ws = new Workspace();await ws.loadModule();const model = new Project(ws);If you are not familiar with the OWA-EPANET Toolkit API or EPANET it is worthwhile reading the OWA-EPANET Toolkit API documentation and the OWA-EPANET wiki.
List of Classes
| Class | Description |
|---|---|
| Workspace | A virtual file system, plus the loader for the underlying WebAssembly EPANET engine (standard or slim, with optional MSX). |
| Project | A handle onto an EPANET project, exposing all toolkit methods as camelCase JavaScript methods. |