Module helpers
The object initCppJs resolves to. These helpers are cpp.js-core, every cpp.js package gets them; the GDAL classes are gdal3.js members on the same object. Under useWorker all of them are async.
Filesystem & data
| HELPER | PURPOSE |
|---|---|
autoMountFiles(files[, parentPath]) | Stream File / Blob inputs (e.g. from <input type=file>) into the VFS; returns the mounted paths. Without parentPath, uses a fresh getRandomPath(). The usual way to get input in. |
getFileBytes(path) | File contents → Uint8Array. Read an output back. |
getFileList(startPath?) | Recursive listing → { path, size }[]. Default start is the writable root. Collects multi-file outputs. |
getDefaultPath() | The writable root: /opfs (default) or /memfs. Browser only. |
getRandomPath(startPath?) | Create and return a fresh unique directory <start>/<app>/automounted/<rand>. Browser only. |
getFinalPath(path) | Validate a path and apply the OPFS → /memfs fallback; throws if /opfs is used without a worker. Browser only. |
FS | The Emscripten virtual FS: mkdirTree, writeFile, readFile, unlink, readdir, rmdir, stat, rename, … Valid after init. |
Filesystem roots and persistence are covered in the VFS guide.
embind vectors
C++ methods take and return embind vector objects, not JS arrays. Convert at the boundary:
| HELPER | PURPOSE |
|---|---|
toVector(classOrName, array = []) | JS array → C++ vector. The first arg is the vector class or its string name. gdal3.js uses "VectorString" (CLI option arrays) and "VectorDataset" (multi-source ops). |
toArray(vector) | C++ vector → JS array (returns the argument unchanged if it is already an array). |
gdal3.js members
On the same Module, but coming from gdal3.js's bound headers rather than cpp.js core: Module.Gdal (the static entry point) and the constructors Module.Dataset, Module.Driver, Module.GCP, Module.SubdatasetInfo, plus the "VectorString" and "VectorDataset" classes referenced by name in toVector.