Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@influxdata/influxdb3-client
Advanced tools
The Client that provides a simple and convenient way to interact with InfluxDB 3.
The JavaScript Client that provides a simple and convenient way to interact with InfluxDB 3. This package supports both writing data to InfluxDB and querying data using the FlightSQL client, which allows you to execute SQL queries against InfluxDB IOx.
To write or query InfluxDB 3, add @influxdata/influxdb3-client
as a dependency to your project using your favorite package manager.
npm install --save @influxdata/influxdb3-client
yarn add @influxdata/influxdb3-client
pnpm add @influxdata/influxdb3-client
If you target Node.js, use @influxdata/influxdb3-client. It provides main (CJS), module (ESM), and browser (UMD) exports.
⚠️ The browser target is not currently supported.
set environment variables:
INFLUXDB_URL
region of your influxdb cloud e.g. https://us-east-1-1.aws.cloud2.influxdata.com/
INFLUXDB_TOKEN
read/write token generated in cloudINFLUXDB_DATABASE
name of database e.g .my-database
export INFLUXDB_URL="<url>"
export INFLUXDB_DATABASE="<database>"
export INFLUXDB_TOKEN="<token>"
set INFLUXDB_URL=<url>
set INFLUXDB_DATABASE=<database>
set INFLUXDB_TOKEN=<token>
$env:INFLUXDB_URL "<url>"
$env:INFLUXDB_DATABASE "<database>"
$env:INFLUXDB_TOKEN "<token>"
To get started with influxdb client import @influxdata/influxdb3-client
package.
import {InfluxDBClient, Point} from '@influxdata/influxdb3-client'
Assign constants for environment variables, and then instantiate InfluxDBClient
inside of an asynchronous function. Make sure to close
the client when it's no longer needed for writing or querying.
const host = process.env.INFLUXDB_URL
const token = process.env.INFLUXDB_TOKEN
const database = process.env.INFLUXDB_DATABASE
async function main() {
const client = new InfluxDBClient({host, token})
// following code goes here
client.close()
}
main()
To write data to InfluxDB, call client.write
with data in line-protocol format and the database (or bucket) name.
const line = `stat,unit=temperature avg=20.5,max=45.0`
await client.write(line, database)
To query data stored in InfluxDB, call client.query
with an SQL query and the database (or bucket) name.
// Execute query
const query = `
SELECT *
FROM "stat"
WHERE
time >= now() - interval '5 minute'
AND
"unit" IN ('temperature')
`
const queryResult = await client.query(query, database)
for await (const row of queryResult) {
console.log(`avg is ${row.avg}`)
console.log(`max is ${row.max}`)
}
For more advanced usage, see examples.
If you need help, please use our Community Slack or Community Page.
New features and bugs can be reported on GitHub: https://github.com/InfluxCommunity/influxdb3-js
To contribute to this project, fork the GitHub repository and send a pull request based on the main
branch.
For now, we're responsible for generating the Flight client. However, its Protobuf interfaces may undergo changes over time.
To regenerate the Flight client, use the yarn flight
command to execute the provided script. The script will clone the Flight Protobuf repository and generate new TypeScript files in ./src/generated/flight
.
The InfluxDB 3 JavaScript Client is released under the MIT License.
FAQs
The Client that provides a simple and convenient way to interact with InfluxDB 3.
The npm package @influxdata/influxdb3-client receives a total of 2,466 weekly downloads. As such, @influxdata/influxdb3-client popularity was classified as popular.
We found that @influxdata/influxdb3-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.