npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qoncrete-sdk-es5

v1.0.2

Published

qoncrete nodejs sdk

Downloads

5

Readme

Qoncrete NodeJS Client SDK

FOR NodeJS V6.8.0+, PLEASE USE THE OFFICE QONCRETE ES6 SDK: https://github.com/qoncrete/client-sdk-node

This is an ES5 version of Quncrete Server-Side SDK, to provide compatibility for old NodeJS projects.

Installation

Using npm:

npm install qoncrete-sdk-es5

Compilation

Using gulp

./gulp

Output goes into ./dist/index.js

Usage

// 1) Require sdk
var Qsdk = require('qoncrete-sdk-node')
// 2) Create a new client.
var client = new Qsdk.QoncreteClient({
    sourceID: 'SOURCE_ID',
    apiToken: 'API_TOKEN',
})
// 3) send a log
client.send({ user: 'toto', action: 'purchase', price: 99.99 })

Client Options

var client = new Qsdk.QoncreteClient({
    sourceID: 'SOURCE_ID', // MANDATORY: The source ID. (Once logged-in, can be found at https://qoncrete.com/account/#!/source)
    apiToken: 'API_TOKEN',// MANDATORY: The api token. (Once logged-in, can be found at https://qoncrete.com/account/#!/token)
    errorLogger: (err) => {},  // A function called on error. Default: (err) => {}
    secureTransport: false, // Send log over SSL. Default: false
    cacheDNS: true, // Active userland dns cache. Default: true"
    timeoutAfter: 15000, // Abort the query on timeout. Default: 15s
    retryOnTimeout: 1, // Number of times to resend the log on timeout. Default: 1 (on timeout, it will retry one more time)
    autoBatch: true, // Try to send log by batch instead of sending them one by one. Default: true
    batchSize: 1000, // Only matters if autoBatch is True. Number of logs to send in a batch. Default: 1000, Max: 1000
    autoSendAfter: 2000, // Only matters if autoBatch is True. Time after the logs will be sent if the batch is not full. Default: 2s
    concurrency: 200 // Number of simultaneous queries that can be made, can be set lower or higher depending your server configuration. Default: 200
})

Example 1: Send each line of a log file.

Example with a log file that contains one json object per line. on the form:

// test.log
{ "user": "toto", "action": "purchase", "price": 99.99 }
{ "user": "titi", "action": "purchase", "price": 42.00 }
{ "user": "tata", "action": "purchase", "price": 84.21 }
// ...
var Qsdk = require('qoncrete-sdk-node')
var readline = require('readline')
var fs = require('fs')

var client = new Qsdk.QoncreteClient({
    sourceID: 'SOURCE_ID',
    apiToken: 'API_TOKEN',
    errorLogger: console.error
})
var rl = readline.createInterface({
    input: fs.createReadStream('test.log')
})

rl.on('line', (line) => { client.send(line) })
rl.on('close', () => console.log('Done reading log file.'))

This is the Node client for qoncrete's custom analytics platform.