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

ots.js

v0.3.1

Published

OTS(2015-12-31) API, PlainBuffer, pkAutoIncrement, Promise Support

Downloads

12

Readme

ots.js

npm version Build Status

Engines

node >=6.0.0 for es6 support

Usage

install

npm install ots.js

init

const OTS = require('ots.js');

let ots = new OTS({
    endPoint: process.env.otsEndPoint,
    accessId: process.env.otsAccessId,
    accessKey: process.env.otsAccessKey,
    instanceName: process.env.otsInstanceName,
    // optional options
    {
        // default 10,connection poolSize
        // use http.Agent, set keepAlie: true
        poolSize: 20
    }
});

// callback style
ots.CreateTable(...args, callback);
// without the callback parameter, it will return a promise object
ots.CreateTable(...args)
  .then(...);

...

Feature

  • Base on 2015-12-31 API (latest API so far)
  • PlainBuffer Support
  • AutoIncrement PrimaryKey Support
  • Promise Support
  • Connetion Pool Support (Base on http1.1 keep-alive)

Test

Before run test, please export following configuration to your env

export \
    otsEndPoint='like http://pl-msgc.cn-hangzhou.ots.aliyuncs.com' \
    otsAccessId='' \
    otsAccessKey='' \
    otsInstanceName='';

then

npm test

Performance

PlainBuffer Test Result

====== Encode bench START ======
EncodeString#PlainBuffer x 30,025 ops/sec ±0.97% (85 runs sampled)
  - memory: { rss: 70176768, heapTotal: 47271936, heapUsed: 29746856 }
EncodeString#Json x 1,175,011 ops/sec ±0.96% (84 runs sampled)
  - memory: { rss: 82063360, heapTotal: 57757696, heapUsed: 21108072 }
EncodeString#protobuf.js x 1,092,644 ops/sec ±1.47% (82 runs sampled)
  - memory: { rss: 81297408, heapTotal: 56709120, heapUsed: 27769104 }
Fastest is EncodeString#Json
====== Decode bench START ======
DecodeString#PlainBuffer x 70,891 ops/sec ±1.28% (85 runs sampled)
  - memory: { rss: 84955136, heapTotal: 58806272, heapUsed: 14220824 }
DecodeString#Json x 656,429 ops/sec ±1.06% (88 runs sampled)
  - memory: { rss: 86065152, heapTotal: 60903424, heapUsed: 14851056 }
DecodeString#protobuf.js x 1,642,783 ops/sec ±1.22% (85 runs sampled)
  - memory: { rss: 86183936, heapTotal: 60923904, heapUsed: 20393256 }
Fastest is DecodeString#protobuf.js

You can also run the benchmark

npm run bench