Minimal InfluxDB client library for Node.js


0.3.33 years ago4 years agoMinified + gzip package size for @danroshko/influxdb-node in KB



Build Status npm version

Minimal InfluxDB client library for Node.js. Features:

  • execute arbitrary InfluxDB commands using Line Protocol and Query Language
  • buffer writes to InfluxDB
  • optionally transform responses from InfluxDB into more convenient arrays of objects
  • write retires


npm i @danroshko/influxdb-node


const Influx = require('@danroshko/influxdb-node');

/* this is the default configuration, all values are optional */
const influx = new Influx({
  db: 'test',
  rp: 'autogen',
  host: '',
  port: 8086,
  maxBufferSize: 100,
  maxBufferTime: 1000,
  retries: 2,
  retriesInterval: 50

  .execute('CREATE DATABASE mydb')
  .then(() => {
    return influx.execute('CREATE RETENTION POLICY one_day ON mydb DURATION 1d REPLICATION 1');
  .then(() => {
    console.log('Database and RP have been created');

/* add point to the internal buffer, it will be
   written to InfluxDB on next buffer flush */
influx.write('cpu,host=server1 value=0.22');

/* write without buffering */
influx.writeImmediate('cpu,host=server1 value=0.22');

influx.query('SELECT "value" FROM test.cpu').then(results => {

Run tests

sudo docker run -it --rm --network="host" influxdb:1.5.1
npm test

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.