This package, `influx`, provides a client library for interacting with InfluxDB 1.x time-series databases from Node.js and browser environments. The current stable version is 5.12.0. Releases are frequent, with several minor versions and bug fixes released annually, indicating active maintenance for the 1.x series. Key differentiators include its full support across Node.js and browsers, a simple API for common InfluxDB operations, and its focus on performance, capable of processing millions of rows per second with zero external dependencies. It's crucial to note that this library is specifically for InfluxDB v1.x; users of InfluxDB v2.x should use the official `@influxdata/influxdb-client-js` package.
npm install influxVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to an InfluxDB 1.x instance, check for and create a database, write a data point, and perform a basic query. It also includes an example of using the `AbortSignal` for query cancellation, a feature introduced in v5.12.0.
Ensure your InfluxDB 1.x instance is configured to accept Basic Auth headers for authentication. If you must send credentials via URL parameters (not recommended for production), you might need to adjust client options if available, or consider downgrading temporarily if unable to update InfluxDB configuration.
If you are using InfluxDB 2.x, migrate to the official InfluxData client library for JavaScript: `@influxdata/influxdb-client-js`.
Upgrade to `influx` version 5.9.7 or newer to resolve timestamp conversion inaccuracies.
Upgrade to `influx` version 5.9.1 or newer to ensure correct encoding of placeholder values in queries.
Double-check your `username` and `password` client options. Ensure your InfluxDB 1.x server is configured for Basic Auth. If using `influx` < 5.11.0 and upgrading, be aware of the authentication method change.
For ES Modules/TypeScript, use `import { InfluxDB } from 'influx';`. If you must use CommonJS, ensure your `require` statement correctly accesses the named export: `const { InfluxDB } = require('influx');` or `const InfluxDB = require('influx').InfluxDB;`.Before attempting to create a database, use `influx.getDatabaseNames()` to check if the database exists. Only call `createDatabase(name)` if the database name is not present in the returned list.
No dependency data recorded yet.