Skip to content

influxdata/influxdb-client-js

Folders and files

NameName
Last commit message
Last commit date
Aug 5, 2024
Aug 8, 2023
Aug 4, 2022
Jul 29, 2024
Feb 14, 2025
Sep 20, 2022
Jun 27, 2022
Jul 26, 2020
Jul 26, 2020
Jun 24, 2019
Feb 2, 2024
Jan 5, 2020
Mar 8, 2019
Aug 15, 2024
Jan 24, 2019
Feb 23, 2023
Jul 19, 2023
Aug 15, 2024
Aug 5, 2024
Oct 5, 2022
Feb 14, 2025

Repository files navigation

influxdb-client-js

CircleCI codecov code style: prettier Language grade: JavaScript License npm Slack Status

This repository contains the JavaScript client library for use with InfluxDB 2.x and Flux. This client supports Node.js, browser, and Deno environments. InfluxDB 3.x users should instead use the lightweight v3 client library. InfluxDB 1.x users may want to use the node-influx client library.

For ease of migration and a consistent query and write experience, v2 users should consider using InfluxQL and the node-influx client library.

Documentation

This section contains links to the client library documentation.

Features

InfluxDB 2.x 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
    • Create/Modify/Delete/Manage
      • buckets
      • tasks
      • authorizations
      • sources
      • ... and other InfluxDB domain objects
    • Delete data from a bucket
    • Invoke a flux script
    • built on @influxdata/influxdb-client

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 (including Deno and Ionic), use @influxdata/influxdb-client-browser in place of @influxdata/influxdb-client. 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:

See examples for more advanced use case like the following:

  • Execute parameterized queries.
  • Delete bucket data.
  • 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.
  • Reuse connections 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, apply changes and submit a pull request to the master branch.

Requirements:

  • Node.js LTS version, v18 recommended
    node --version
  • yarn 1.22.19 or higher
    yarn -v

Run tests:

$ yarn test

Check code coverage:

$ yarn coverage

Build distributions:

$ yarn build

License

The InfluxDB 2.x JavaScript client is released under the MIT License.