Core module · options API
LoaderOptions
Configure the shared runtime behavior of loaders.gl APIs, then add format-specific options under the loader namespace that owns them.
The options boundary
Keep runtime policy separate from format policy.
Shared options control fetching, workers, concurrency, logging, shapes, and transforms. Loader-specific namespaces describe how an individual format should be decoded or encoded.
Runtime
Fetch, logging, errors, and worker execution
Concurrency
Pool size, reuse, and mobile limits
Shape
Shared default output representation
Format
Options nested under each loader ID
Detailed guide
LoaderOptions reference
The sections below document core options, loader-specific namespaces, batched parsing, and compatibility aliases.
Parser APIs in @loaders.gl/core accept an options?: LoaderOptions parameter. Shared controls
live in core, beside format-specific namespaces. Sources use the same flat placement of shared
controls and parser namespaces; see Source options
for source-specific settings, precedence, and type inference. Sources do not accept core.loadOptions
or a top-level loadOptions wrapper.
compareLoaderOptions
compareLoaderOptions(left: LoaderOptions | undefined, right: LoaderOptions | undefined): boolean
Import this helper from @loaders.gl/core to compare two options inputs. It compares the own
enumerable properties of plain objects and arrays recursively, including nested loader namespaces.
Object key order is ignored and array order matters. Callbacks, signals, and other objects such
as Headers compare by reference. The comparison uses the supplied values directly, before
loader defaults and global options are applied.
Core options
Options interpreted by the core API and shared across loaders live under options.core.
| Option | Type | Default | Description |
|---|---|---|---|
options.core.fetch | object or function | - | Specifies either a RequestInit object containing options to pass to fetchFile, or a function that is called in place of fetchFile to fetch data in any subloaders. |
options.core.nothrow | boolean | false | Prevents throwing on loader errors and lets callers inspect failures manually. |
options.core.mimeType | string | - | Loader selection will first look for a loader matching mimeType. A specific loader can be specified using 'application/x-<loader.id>'. |
options.core.fallbackMimeType | string | - | Loader selection fallback mimeType in case one is not provided by the server. A specific loader can be specified with 'application/x-<loader.id>'. |
options.core.log | Logger or null | Shared loaders.gl logger | Routes operation diagnostics to the supplied logger. Set null to suppress diagnostics. |
options.core.worker | boolean | 'auto' | true | Runs the loader on a worker thread, if the selected loader and the runtime environment support it. 'auto' uses a loader's synchronous work estimate for atomic parse() calls. |
options.core.workerThreshold | number | 0.1 | Threshold for worker: 'auto'; scores below it stay on the calling thread and scores at or above it use a worker. Must be finite and between 0 and 1. |
options.core.maxConcurrency | number | 3 | Maximum concurrent task handles per loader descriptor, configured by its first request. Note that setting this higher than roughly the number CPU cores on your current machine will not provide much benefit and may create extra overhead. |
options.core.maxMobileConcurrency | number | 1 | How many worker instances should be created for each loader on mobile devices. Mobile devices have fewer cores and less memory available. |
options.core.reuseWorkers | boolean | deprecated | Ignored. Each atomic call or batch stream closes its task handle and worker on completion. |
options.<loader-id>.workerUrl | string | per-loader | If the corresponding loader can parse on a worker, the URL to its worker script can be controlled with this option. |
options.modules | object | - | Supply bundled JS/WASM runtime modules or URL overrides. See the dependency guide and individual loader or writer docs for supported keys. |
options.core.CDN (🚧 experimental) | string | - | Overrides the CDN base URL used for worker and runtime script loading. Supply a URL string; local-library behavior is configured separately with core.useLocalLibraries. |
options.core.shape | string | per-loader | Shared default return shape for loaders that support shape selection. For example, options.core.shape = 'object-row-table' applies to row-table loaders unless a loader-specific option like options.csv.shape overrides it. |
Logging
Pass a probe.gl logger as core.log to capture operation diagnostics on
the calling thread. Use null to suppress diagnostics. The example captures messages in a
probe.gl MemoryLog.
import {MemoryLog} from 'probe.gl/log';
const log = new MemoryLog();
const result = await parse(bytes, loader, {core: {log, worker: false}});
const diagnostics = log.messages;
Workers use a logger in their own execution context and honor core.log: null. Set
core.worker to false to capture parser diagnostics with your logger on the calling thread.
Authentication options
options.core.credentials accepts an ordered array of runtime credentials or typed JSON
configurations. options.core.authentications accepts authentication class constructors used to
instantiate those configurations by matching their static type. The selected loader can also
contribute constructors through getAuthentications(url, options); application classes take
precedence. There is no implicit global class registry.
Credentials include origin-scoped header/query tokens and application request-signing callbacks. Callbacks run after request defaults and token credentials have been applied. See the authentication guide for declarative configuration, provider classes, callback contracts and worker restrictions.
Loader specific options
The options object can contain loader specific options. The options for each loader are supplied in a sub object, see the documentation for each loader for details:
{
core: {
shape: 'object-row-table'
},
csv: {
shape: 'array-row-table'
},
json: {
shape: 'object-row-table'
}
}
Experimental scan requests
Loaders that implement the scan protocol accept a root _scan request typed as
QueryOptions. Supported fields depend on the format; this is not a promise that every
loader implements every scan operation. See the
common scan architecture and each loader's reference
for supported behavior. The final stability and naming policy, including its relationship to source
scan() and query() methods, remains a pre-v5 decision in
tracker #3316.
Batched parsing options
| Option | Type | Default | Description |
|---|---|---|---|
options.core.metadata | boolean | false | An initial batch with batchType: 'metadata' will be added with information about the data being loaded. |
options.core.chunkSize | number | N/A | When set, "atomic" inputs (like ArrayBuffer or string) are chunked, enabling batched parsing. No effect if input is already an iterator or stream. |
options.core.transforms | *[] | [] | An array with transform functions that can be applied to the input data before parsing. |
Notes:
transformsis an array functions that accept and return anAsyncIterable<ArrayBuffer>
Set core.batchMaxRowsPerSecond to pace data batch delivery by row count. A value
of 0 (the default) disables pacing. The first data batch is immediate. After
delivering 5,000 rows at 20,000 rows per second, the next data batch is eligible
250 ms later. Time spent parsing or consuming the previous batch counts toward
that interval. The schedule restarts at each delivery, so stalls do not cause
catch-up bursts. Metadata does not affect the schedule, and pacing preserves
native batch boundaries.
const batches = await loadInBatches(url, LASLoader, {
core: {batchSize: 5_000, batchMaxRowsPerSecond: 20_000}
});
Use batchSize to control the number of points per update in a deck.gl
point cloud and batchMaxRowsPerSecond to control how quickly they appear.
For tagged trace outputs, the rate applies to span rows (slice rows in Perfetto). Related tables pass through without using that budget.
Use table scans for offset and limit so sources can push row selection into their decoders. To stop a plain batch load early, break out of the async iterator.