New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-tsguru

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-tsguru

TimeSeries.Guru Node.js client

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status NPM version NPM dependencies

node-tsguru

TimeSeries.Guru Node.js client.

Installation

npm install node-tsguru

Demo

There is a demo application available at https://github.com/widdix/node-tsguru-demo

Usage

Callback style

Create client
var tsguru = require("node-tsguru");
tsguru({token: "abc123456789def", databaseID: "abc123456789def"}, function(err, client) {
	if (err) throw err;
	console.log("connected");
	// interact with client like demonstrated below
});
Insert single value
client.insert("sensor01", 123.45, function(err) {
	if (err) throw err;
	console.log("inserted");
});
Insert multiple values
client.bulk()
	.add("sensor01", 123.45)
	.add("sensor02", 234.56)
	.add("sensor03", 345.67)
	.add("sensor04", 456.78)
	.insert(function(err) {
		if (err) throw err;
		console.log("bulk inserted");
	});

Promise style

Create client
var tsguru = require("node-tsguru");
tsguru({token: "abc123456789def", databaseID: "abc123456789def"})
	.then(function(client) {
		console.log("connected");
		// interact with client like demonstrated below
	})
	.catch(function(err) {
		console.log(err);
	});
Insert single value
client.insert("sensor01", 123.45)
	.then(function(client) {
		console.log("inserted");
	})
	.catch(function(err) {
		console.log(err);
	});
Insert multiple values
client.bulk()
	.add("sensor01", 123.45)
	.add("sensor02", 234.56)
	.add("sensor03", 345.67)
	.add("sensor04", 456.78)
	.insert()
		.then(function(client) {
			console.log("bulk inserted");
		})
		.catch(function(err) {
			console.log(err);
		});

API

(params[, cb])

  • params: Object
    • token: String
    • databaseID: String
    • timeout: Number in milliseconds (optional, default: 10000)
  • cb: Function(err, client) (optional)
    • err: Error or undefined
    • client: Client or undefined

returns a Promise if no cb was supplied

Client

insert(timeseriesName, value[, cb])
  • timeseriesName: String
  • value: Number
  • cb: Function(err) (optional)
    • err: Error or undefined

returns a Promise if no cb was supplied

bulk()

returns a Bulk

Bulk
add(timeseriesName, value)
  • timeseriesName: String
  • value: Number
insert([cb])

Insert takes care about maximal allowed body size. A single insert can be split into multiple POST calls if the HTTP body gets to large.

  • cb: Function(err) (optional)
    • err: Error or undefined

returns a Promise if no cb was supplied

Keywords

FAQs

Package last updated on 05 Jan 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc