The reference javascript client for InfluxDB 2.x. Both node and browser environments are supported. The package.json
Node.js distributions do not work in browser and vice versa, because different platform APIs are used. Use @influxdata/influxdb-client-browser
to import browser ESM module. See https://github.com/influxdata/influxdb-client-js to know more.
Note: This library is for use with InfluxDB 2.x or 1.8+. For connecting to InfluxDB 1.x instances, see node-influx.
The
@influxdata/influxdb-client
package provides optimized APIs that write or query InfluxDB v2.Remarks
The entry point of this package is the @influxdata/influxdb-client!InfluxDB class. It is initialized with options that tells how to communicate with InfluxDB. The simple usage pattern is:
The influxDB object let you create two essential API instances, @influxdata/influxdb-client!InfluxDB.getWriteApi and @influxdata/influxdb-client!InfluxDB.getQueryApi. The @influxdata/influxdb-client!WriteApi asynchronously writes measurement points on background, in batches to optimize network traffic, and with retries upon failures. The @influxdata/influxdb-client!QueryApi let you execute a flux query against InfluxDB and offers several ways to stream query results.
The influxDB object is also used to create more specialized InfluxDB management API instances in @influxdata/influxdb-client-apis .
See also examples to know more.