{"id":19238030,"url":"https://github.com/im-js/ots.js","last_synced_at":"2025-07-20T12:06:03.626Z","repository":{"id":57316788,"uuid":"88226291","full_name":"im-js/ots.js","owner":"im-js","description":"OTS(2015-12-31) API, PlainBuffer, pkAutoIncrement Support","archived":false,"fork":false,"pushed_at":"2017-05-24T06:42:37.000Z","size":66,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T12:17:31.736Z","etag":null,"topics":["ots"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/im-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-14T02:48:00.000Z","updated_at":"2017-04-27T05:57:15.000Z","dependencies_parsed_at":"2022-08-25T20:40:57.514Z","dependency_job_id":null,"html_url":"https://github.com/im-js/ots.js","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/im-js/ots.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-js%2Fots.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-js%2Fots.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-js%2Fots.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-js%2Fots.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/im-js","download_url":"https://codeload.github.com/im-js/ots.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-js%2Fots.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263572048,"owners_count":23482313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ots"],"created_at":"2024-11-09T16:29:07.164Z","updated_at":"2025-07-20T12:06:03.603Z","avatar_url":"https://github.com/im-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ots.js\n[![npm version](https://img.shields.io/npm/v/ots.js.svg)](https://www.npmjs.com/package/ots.js)\n[![Build Status](https://travis-ci.org/im-js/ots.js.svg?branch=master)](https://travis-ci.org/im-js/ots.js)\n\n## Engines\n`node \u003e=6.0.0` for es6 support\n\n## Usage\ninstall\n```javascript\nnpm install ots.js\n```\ninit\n```javascript\nconst OTS = require('ots.js');\n\nlet ots = new OTS({\n    endPoint: process.env.otsEndPoint,\n    accessId: process.env.otsAccessId,\n    accessKey: process.env.otsAccessKey,\n    instanceName: process.env.otsInstanceName,\n    // optional options\n    {\n        // default 10，connection poolSize\n        // use http.Agent, set keepAlie: true\n        poolSize: 20\n    }\n});\n\n// callback style\nots.CreateTable(...args, callback);\n// without the callback parameter, it will return a promise object\nots.CreateTable(...args)\n  .then(...);\n\n...\n```\n\n## Feature\n* Base on `2015-12-31` API (latest API so far)\n* PlainBuffer Support\n* AutoIncrement PrimaryKey Support\n* Promise Support\n* Connetion Pool Support (Base on http1.1 keep-alive)\n\n## Test\nBefore run test, please export following configuration to your env\n```shell\nexport \\\n    otsEndPoint='like http://pl-msgc.cn-hangzhou.ots.aliyuncs.com' \\\n    otsAccessId='' \\\n    otsAccessKey='' \\\n    otsInstanceName='';\n```\nthen\n```shell\nnpm test\n```\n\n## Performance\nPlainBuffer Test Result\n```\n====== Encode bench START ======\nEncodeString#PlainBuffer x 30,025 ops/sec ±0.97% (85 runs sampled)\n  - memory: { rss: 70176768, heapTotal: 47271936, heapUsed: 29746856 }\nEncodeString#Json x 1,175,011 ops/sec ±0.96% (84 runs sampled)\n  - memory: { rss: 82063360, heapTotal: 57757696, heapUsed: 21108072 }\nEncodeString#protobuf.js x 1,092,644 ops/sec ±1.47% (82 runs sampled)\n  - memory: { rss: 81297408, heapTotal: 56709120, heapUsed: 27769104 }\nFastest is EncodeString#Json\n====== Decode bench START ======\nDecodeString#PlainBuffer x 70,891 ops/sec ±1.28% (85 runs sampled)\n  - memory: { rss: 84955136, heapTotal: 58806272, heapUsed: 14220824 }\nDecodeString#Json x 656,429 ops/sec ±1.06% (88 runs sampled)\n  - memory: { rss: 86065152, heapTotal: 60903424, heapUsed: 14851056 }\nDecodeString#protobuf.js x 1,642,783 ops/sec ±1.22% (85 runs sampled)\n  - memory: { rss: 86183936, heapTotal: 60923904, heapUsed: 20393256 }\nFastest is DecodeString#protobuf.js\n```\nYou can also run the benchmark\n```shell\nnpm run bench\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fim-js%2Fots.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fim-js%2Fots.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fim-js%2Fots.js/lists"}