influxdb-client-js
This repository contains the reference JavaScript client for InfluxDB 2.0. This client supports Node.js, browser, and Deno environments.
node-influx client library. This library can also write/query flux-enabled InfluxDB 1.8+.
Note: Use this client library with InfluxDB 2.x. For connecting to InfluxDB 1.x see theDocumentation
This section contains links to the client library documentation.
Features
InfluxDB 2.0 client consists of two main packages
- @influxdata/influxdb-client
- Query data using the Flux language
- Write data to InfluxDB
- batch data in the background
- retry automatically on failure
- @influxdata/influxdb-client-apis
- Manage the following in InfluxDB:
- sources
- buckets
- tasks
- authorizations
- built on @influxdata/influxdb-client
- Manage the following in InfluxDB:
Installation
To write or query InfluxDB, add @influxdata/influxdb-client
as a dependency to your project using your favorite package manager.
$ npm install --save @influxdata/influxdb-client
$ yarn add @influxdata/influxdb-client
$ pnpm add @influxdata/influxdb-client
If you target Node.js, use @influxdata/influxdb-client. It provides main (CJS), module (ESM), and browser (UMD) exports.
If you target browsers or Deno, use @influxdata/influxdb-client-browser. It provides main (UMD) and module (ESM) exports.
To use InfluxDB management APIs in your project, also add @influxdata/influxdb-client-apis
as a dependency to your project.
$ npm install --save @influxdata/influxdb-client-apis
$ yarn add @influxdata/influxdb-client-apis
$ pnpm add @influxdata/influxdb-client-apis
Usage
Use the following examples to get started with the JavaScript client for InfluxDB:
- @influxdata/influxdb-client
- @influxdata/influxdb-client-apis
See examples for more advanced use case like the following:
- Execute parameterized queries.
- Use the client library with InfluxDB 1.8+.
- Use the client library in the browser or Deno.
- Process InfluxDB query results with RX Observables.
- Customize the writing of measurement points to InfluxDB.
- Visualize query results in Giraffe.
- Setup HTTP/HTTPS proxy in communication with InfluxDB.
JavaScript client API Reference Documentation is available online at https://influxdata.github.io/influxdb-client-js/ .
Contributing
To contribute code, fork the repository and submit a pull request in GitHub to the JavaScript client master
branch.
Build Requirements:
- Node.js v14 LTS
node --version
- yarn 1.9.4. or higher
yarn -v
Run tests:
$ yarn test
Check code coverage:
$ yarn coverage
Build distributions:
$ yarn build
License
The InfluxDB 2.0 JavaScript client is released under the MIT License.