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

@ts3/query-utils

v2.0.2

Published

TeamSpeak 3 ServerQuery tools

Downloads

2

Readme

TeamSpeak 3 Query Utils

Query builder and response parser for TeamSpeak 3 ServerQuery interface

Build Status Dependency Status Donate

Installation

$ npm install @ts3/query-utils --save

Note: TeamSpeak3 Utils is embedded into the TeamSpeak3 Query Client package.

Import what you want where you need it with typescript

import {parseResponse} from "@ts3/query-utils";
console.log(parseResponse("error id=0 msg=ok")) // {id: 0, msg: "ok"}

Or simply use NodeJS

let TS3Utils = require('@ts3/query-utils');
console.log(TS3Utils.parseResponse("error id=0 msg=ok")) // {id: 0, msg: "ok"}

This package is ES6 compliant, it require NodeJS 6+

Build your queries

The buildQuery method is an helper wich allow you to build easily your queries. The query is automaticly escaped and the result is returned.

If an error is occurred, the result is an instance of Error

let ts3utils = require('teamspeak3-utils')
let query = ts3utils.buildQuery('serveredit', {virtualserver_name:'TeamSpeak ]|[ Server'})

if(query instanceof Error) {
  console.log('Error: ' + query.message)
} else {
  console.log(query) // serveredit virtualserver_name=TeamSpeak\s]\p[\sServer  
}

Parse responses

The parseResponse method provide an easy way to treat your data.

let ts3utils = require('teamspeak3-utils')
let res = ts3utils.parseResponse('error id=0 msg=ok')

if(res instanceof Error) {
  console.log('Error: ' + query.message)
} else {
  console.log(res) // [ { error: '', id: 0, msg: 'ok' } ]
}

Definitions

The TeamSpeak 3 definitions are available in one object. You can use it to set easily your values.

let ts3defs = require('teamspeak3-utils/definitions')

console.log(ts3defs.CODEC_CRYPT_ENABLED) // 2

Retrieve client version/build

Since the version 1.4.0 i have introduced the list of client versions/builds for the desktop, android and ios, you can use it as you wish.

let TS3ClientVersions = require('teamspeak3-utils/client-versions')

Note: Sometime build can have several versions and version can have several builds, so the methods always return an array

You can easily get the builds for a specified client version with getClientBuildByVersion

let ts3utils = require('teamspeak3-utils')
let builds = ts3utils.getClientBuildByVersion('3.0.5', 'desktop')

if(builds instanceof Error) {
  console.log('Error: ' + builds.message)
} else {
  console.log(builds) // [1328254851, 1328791207, 1329129765, 1329301801]
}

and get the client versions for a specified build with getClientVersionByBuild

let ts3utils = require('teamspeak3-utils')
let versions = ts3utils.getClientBuildByVersion(1427190433, 'android')

if(versions instanceof Error) {
  console.log('Error: ' + versions.message)
} else {
  console.log(versions) // ['3.0.18', '3.0.18.1']
}

Escaping

All the escape & unescape methods have the same workaround, you provide a string and it returns the final string.

let ts3utils = require('teamspeak3-utils')

console.log(ts3utils.escape('Hello world!')) // Hello\\sworld!
console.log(ts3utils.unescape('Hello\\sworld!')) // Hello world!

You can use specifics methods if you need, here are the methods :

  • escapeBackslashes / unescapeBackslashes
  • escapeBell / unescapeBell
  • escapeCarriagesReturns / unescapeCarriagesReturns
  • escapeFormfeeds / unescapeFormfeeds
  • escapeNewlines / unescapeNewlines
  • escapePipes / unescapePipes
  • unescapeSlashes / escapeSlashes
  • escapeTabulations / unescapeTabulations
  • escapeVerticalTabulations / unescapeVerticalTabulations
  • escapeWhitespaces / unescapeWhitespaces

Bugs & suggestions

If you found bug or have any suggestion feel free to open a ticket