{"id":34271703,"url":"https://github.com/michaelwittig/node-q","last_synced_at":"2026-03-17T22:07:07.379Z","repository":{"id":22243129,"uuid":"25576531","full_name":"michaelwittig/node-q","owner":"michaelwittig","description":"Q interfacing with Node.js","archived":false,"fork":false,"pushed_at":"2023-10-24T22:19:42.000Z","size":232,"stargazers_count":53,"open_issues_count":9,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-12-20T08:18:21.252Z","etag":null,"topics":["kdb","qlang"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelwittig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-22T10:53:11.000Z","updated_at":"2025-11-14T05:02:37.000Z","dependencies_parsed_at":"2024-06-18T20:09:37.659Z","dependency_job_id":"fa297a5b-b93a-4a74-9109-c51ad41627da","html_url":"https://github.com/michaelwittig/node-q","commit_stats":{"total_commits":138,"total_committers":10,"mean_commits":13.8,"dds":"0.34782608695652173","last_synced_commit":"680a42da5174f3d9ccd96232ea8e5816d3597f20"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/michaelwittig/node-q","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwittig","download_url":"https://codeload.github.com/michaelwittig/node-q/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwittig%2Fnode-q/sbom","scorecard":{"id":641703,"data":{"date":"2025-08-11","repo":{"name":"github.com/michaelwittig/node-q","commit":"17641112da5296c3c7920de26dc23d8cba73fcf9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":3,"reason":"Found 9/30 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/michaelwittig/node-q/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/michaelwittig/node-q/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"65 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-wrw9-m778-g6mc","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-6cpc-mj5c-m9rq","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-jcpv-g9rr-qxrc","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-753c-phhg-cj29","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-265q-28rp-chq5","Warn: Project is vulnerable to: GHSA-m5h6-hr3q-22h5","Warn: Project is vulnerable to: GHSA-ph34-pc88-72gc","Warn: Project is vulnerable to: GHSA-m6cx-g6qm-p2cx","Warn: Project is vulnerable to: GHSA-x8qc-rrcw-4r46","Warn: Project is vulnerable to: GHSA-4328-8hgf-7wjr","Warn: Project is vulnerable to: GHSA-93f3-23rq-pjfp","Warn: Project is vulnerable to: GHSA-pw54-mh39-w3hc","Warn: Project is vulnerable to: GHSA-xgh6-85xh-479p","Warn: Project is vulnerable to: GHSA-57cf-349j-352g","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-7xfp-9c55-5vqj","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-x6fg-f45m-jf5q","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-gfjr-3jmm-4g9v","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-qhv9-728r-6jqg","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-34r7-q49f-h37c","Warn: Project is vulnerable to: GHSA-c9f4-xj24-8jqx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T10:56:04.319Z","repository_id":22243129,"created_at":"2025-08-21T10:56:04.319Z","updated_at":"2025-08-21T10:56:04.319Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30633240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["kdb","qlang"],"created_at":"2025-12-16T19:43:54.322Z","updated_at":"2026-03-17T22:07:07.371Z","avatar_url":"https://github.com/michaelwittig.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-q\n\nQ interfacing with Node.js. Supports [decompression](http://code.kx.com/wiki/Reference/ipcprotocol#Compression). Can deserialize all q data types (including `guid`) to JavaScript. Can serialize all JavaScript data types to q.\n\n## Installation\n\n```\nnpm install node-q\n```\n\n## Usage\n\n### Create Connection\n\n```javascript\nvar nodeq = require(\"node-q\");\nnodeq.connect({host: \"localhost\", port: 5000}, function(err, con) {\n\tif (err) throw err;\n\tconsole.log(\"connected\");\n\t// interact with con like demonstrated below\n});\n```\n\n### Create TLS Connection\n\n```javascript\nvar nodeq = require(\"node-q\");\nnodeq.connect({host: \"localhost\", port: 6000, useTLS: true}, function(err, con) {\n\tif (err) throw err;\n\tconsole.log(\"connected\");\n\t// interact with con like demonstrated below\n});\n```\n\n### Create Connection with user and password auth\n\n```javascript\nvar nodeq = require(\"node-q\");\nnodeq.connect({host: \"localhost\", port: 5000, user: \"user\", password: \"password\"}, function(err, con) {\n\tif (err) throw err;\n\tconsole.log(\"connected\");\n\t// interact with con like demonstrated below\n});\n```\n\n### Create Connection with Unix Domain Socket (Doesn't support abstract namespace sockets: KDB 3.5+ on Linux)\n\n```javascript\nnodeq.connect({ unixSocket: \"/path/to/socket\" }, function(err, con) {\n\tif (err) throw err;\n\tconsole.log(\"connected\");\n});\n```\n\n### Execute Q code and receive result\n\n```javascript\ncon.k(\"sum 1 2 3\", function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res); // 6\n});\n```\n\n### Execute function with one parameter and receive result\n\n```javascript\ncon.k(\"sum\", [1, 2, 3], function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res); // 6\n});\n```\n\n### Execute function with two parameters and receive result\n\n```javascript\ncon.k(\"cor\", [1, 2, 3], [4, 5, 6], function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res); // 1\n});\n```\n\n### Async execute Q code\n\n```javascript\ncon.ks(\"show 1 2 3\", function(err) {\n\tif (err) throw err;\n});\n```\n\n### Async execute function with parameters\n\n```javascript\ncon.ks(\"show\", [1, 2, 3], function(err) {\n\tif (err) throw err;\n});\n```\n\n### Listen to a handle\n\n```javascript\ncon.k(function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res);\n});\n```\n\n### Subscribe to kdb+tick\n\n```javascript\ncon.on(\"upd\", function(table, data) {\n\tconsole.log(table, data);\n});\n\ncon.ks(\".u.sub[`;`]\", function(err) { // subscribe to all tables and all symbols\n\tif (err) throw err;\n});\n```\n\n### Close connection\n\n```javascript\ncon.close(function() {\n\tconsole.log(\"con closed\");\n});\n```\n\n## Types\n\nq has more [data types](http://code.kx.com/wiki/Reference/Datatypes) than JavaScript. Therefore you need to know how types are converted.\n\n### From q to JavaScript (deserialization)\n\n| q type | JavaScript type | Null | +Infinity | -Infinity |\n| ------ | --------------- | ---- | --------- | --------- |\n| boolean | [Boolean](https://developer.mozilla.org/docs/Glossary/Boolean) | | | |\n| guid | [String](https://developer.mozilla.org/docs/Glossary/String) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| byte | [Number](https://developer.mozilla.org/docs/Glossary/Number) | | | |\n| short | [Number](https://developer.mozilla.org/docs/Glossary/Number) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) |\n| int | [Number](https://developer.mozilla.org/docs/Glossary/Number) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) |\n| long | [Number](https://developer.mozilla.org/docs/Glossary/Number) \u003csup\u003e[5](#types-footnote5)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) |\n| real | [Number](https://developer.mozilla.org/docs/Glossary/Number) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) |\n| float | [Number](https://developer.mozilla.org/docs/Glossary/Number) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) |\n| char | [String](https://developer.mozilla.org/docs/Glossary/String) | [Null](https://developer.mozilla.org/docs/Glossary/Null) \u003csup\u003e[4](#types-footnote4)\u003c/sup\u003e | | |\n| symbol | [String](https://developer.mozilla.org/docs/Glossary/String) | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| timestamp | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[1](#types-footnote1), [2](#types-footnote2)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| month | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| date | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| datetime | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| timespan | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[1](#types-footnote1), [2](#types-footnote2), [3](#types-footnote3)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| minute | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2), [3](#types-footnote3)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| second | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2), [3](#types-footnote3)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n| time | [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \u003csup\u003e[2](#types-footnote2), [3](#types-footnote3)\u003c/sup\u003e | [Null](https://developer.mozilla.org/docs/Glossary/Null) | | |\n\n* \u003ca name=\"types-footnote1\"\u003e1\u003c/a\u003e: q comes with nanoseconds precision. JavaScript only with milliseconds. You can disable `nanos2date` deserialization during `connect(params, cb)` to get the nanoseconds timestamp as a plain [Number](https://developer.mozilla.org/docs/Glossary/Number).\n* \u003ca name=\"types-footnote2\"\u003e2\u003c/a\u003e: think about running your Node.js process with `TZ=UTC node ...` to run in UTC timezone. q doesn't know timezones.\n* \u003ca name=\"types-footnote3\"\u003e3\u003c/a\u003e: date is set to `2000-01-01` in the Date object. Only evaluate the time part.\n* \u003ca name=\"types-footnote4\"\u003e4\u003c/a\u003e: You can disable `emptyChar2null` deserialization during `connect(params, cb)` to keep the empty char.\n* \u003ca name=\"types-footnote5\"\u003e5\u003c/a\u003e: You can disable `long2number` deserialization during `connect(params, cb)` to represent longs as [long.js](https://www.npmjs.com/package/long).\n\n#### dict\n\n```\nq) (`a`b`c)!(1 2 3i)\n```\n\nbecomes [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n\n```javascript\n{\n\ta: 1,\n\tb: 2,\n\tc: 3\n}\n```\n\n#### list\n\n```\nq) 1 2 3i\n```\n\nbecomes [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\n\n```javascript\n[1, 2, 3]\n```\n\n#### table\n\n```\nq) ([] sym:`a`b`c; size:(1 2 3i))\n```\n\nbecomes [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) of [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) per row.\n\n```javascript\n[\n\t{sym: \"a\", size: 1},\n\t{sym: \"b\", size: 2},\n\t{sym: \"c\", size: 3}\n]\n```\n\nYou can disable `flipTables` during `connect(params, cb)` to get a table as an [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) with an [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) per column.\n\n```javascript\n{\n\tsym: [\"a\", \"b\", \"c\"],\n\tsize: [1, 2, 3]\n}\n```\n\n### From JavaScript to q (serialization)\n\n#### Simple (infer type)\n\n| JavaScript type | q type |\n| --------------- | ------ |\n| [Boolean](https://developer.mozilla.org/docs/Glossary/Boolean) | boolean |\n| [String](https://developer.mozilla.org/docs/Glossary/String) starting with ` | symbol |\n| [String](https://developer.mozilla.org/docs/Glossary/String) | list[char] |\n| [Number](https://developer.mozilla.org/docs/Glossary/Number) | float |\n| [Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) | datetime |\n| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | dict |\n| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)[*] | list[*] |\n| [Null](https://developer.mozilla.org/docs/Glossary/Null) | unary primitive |\n| [Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | float |\n| -[Infinity](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Infinity) | float |\n\n#### Advanced (explicit types)\n\nIf you want to explicitly serialize a JavaScript type as a q type you need to use the typed API.\n\nLet's start with two examples:\n\n```javascript\ncon.k(\"type\", nodeq.short(1), function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res); // -5\n});\n\ncon.k(\"type\", nodeq.shorts([1, 2, 3]), function(err, res) {\n\tif (err) throw err;\n\tconsole.log(\"result\", res); // 5\n});\n```\n\nFor every primitive type in q, this module exports a method to wrap the JavaScript value. You can also wrap a JavaScript array into a q type by appending an s to the primitive wrapper's name.\n\n| q type | primitive wrapper | array wrapper |\n| ------ | ----------------- | ------------- |\n| boolean | `boolean(Boolean)` | `booleans(Array[Boolean])` |\n| guid | `guid(String)`| `guids(Array[String])` |\n| byte | `byte(Number)`| `bytes(Array[Number])` |\n| short | `short(Number)` | `shorts(Array[Number])` |\n| int | `int(Number)` | `ints(Array[Number])` |\n| long | `long(long)` \u003csup\u003e[1](#wrappers-footnote1)\u003c/sup\u003e | `longs(Array[long])` \u003csup\u003e[1](#wrappers-footnote1)\u003c/sup\u003e |\n| real | `real(Number)` | `reals(Array[Number])` |\n| float | `float(Number)` | `floats(Array[Number])` |\n| char | `char(String)` | `chars(Array[String])` |\n| symbol | `symbol(String)` | `symbols(Array[String])` |\n| timestamp | `timestamp(Date)` | `timestamps(Array[Date])` |\n| month | `month(Date)` | `months(Array[Date])` |\n| date | `date(Date)` | `dates(Array[Date])` |\n| datetime | `datetime(Date)` | `datetimes(Array[Date])` |\n| timespan | `timespan(Date)` | `timespans(Array[Date])` |\n| minute | `minute(Date)` | `minutes(Array[Date])` |\n| second | `second(Date)` | `seconds(Array[Date])` |\n| time | `time(Date)` | `times(Array[Date])` |\n\n* \u003ca name=\"wrappers-footnote1\"\u003e1\u003c/a\u003e: JavaScript can not represent 64bit longs. Therefore this module uses the [long.js](https://www.npmjs.com/package/long) module to represent longs.\n\n## API\n\n### connect(params, cb)\n\n* `params`: Object\n\t* `host`: String (e. g. \"localhost\") (optional)\n\t* `port`: Number (e. g. 5000) (optional)\n\t* `unixSocket`: String (e. g. \"/path/to/socket\") (optional)\n\t* `user`: String (optional)\n\t* `password`: String (optional)\n\t* `useTLS`: Boolean (optional)\n\t* `ca`: Buffer | String (e.g. fs.readFileSync('path\\\\to\\\\cert.pem')) (optional)\n\t* `socketNoDelay` : Boolean (optional, see http://nodejs.org/api/net.html#net_socket_setnodelay_nodelay)\n\t* `socketTimeout`: Number (optional, see http://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback)\n\t* `nanos2date`: Boolean (optional, default: true)\n\t* `flipTables`: Boolean (optional, default: true)\n\t* `emptyChar2null`: Boolean (optional, default: true)\n\t* `long2number`: Boolean (optional, default: true)\n* `cb`: Function(`err`, `con`)\n\t* `err`: `Error` or `undefined`\n\t* `conn`: `Connection` or `undefined`\n\n### @deprecated connect(host, port, [user, password,] cb)\n\nThis is deprecated. Please use the new, mor flexible API above!\n\n* `host`: String (e. g. \"localhost\")\n* `port`: Number (e. g. 5000)\n* `user`: String (optional)\n* `password`: String (optional)\n\n### Connection\n\nIs an [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter).\n\n#### k(s, [x, [y, [z, [...,] ] ] ] cb)\n\nSync request/response.\n\n* `s`: String\n* `x`: Object (optional)\n* `y`: Object (optional)\n* `z`: Object (optional)\n* `...`: Object (optional)\n* `cb`: Function(`err`, `res`)\n\t* `err`: `Error` or `undefined`\n\t* `res`: `Object` or `undefined`\n\n#### ks(s, [x, [y, [z, [...,] ] ] ] cb)\n\nAsync request.\n\n* `s`: String\n* `x`: Object (optional)\n* `y`: Object (optional)\n* `z`: Object (optional)\n* `...`: Object (optional)\n* `cb`: Function(`err`)\n\t* `err`: `Error` or `undefined`\n\n#### close(cb)\n\n* `cb`: Function(`err`) (optional)\n\t* `err`: `Error` or `undefined`\n\n#### Events\n\n##### upd(table, data)\n\nIf you use kdb+tick and subscribe like `con.ks(\".u.sub[`;`]\", function(err) { throw err; })` you will receive all Updates via `upd` Event.\n\n* `table`: String (e.g. trades)\n* `data`: Object (table represented in JavaScript as [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) of [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))\n\n##### error(err)\n\nIf the socket emit an `error` event.\n\n* `err`: `Error`\n\n##### end()\n\nIf the socket emit an `end` event.\n\n##### timeout()\n\nIf the socket emit a `timeout` event.\n\n##### close(had_error)\n\nIf the socket emit a `close` event.\n\n* `had_error`: Boolean (true if the socket had a transmission error)\n\n## Contribution\n\nIf you want to create a Pull-Request please make sure that `make test` runs without failures.\n\nIf you have a kdb+tick setup please also run `make mochait`.\n\n### Code Style\n\n\tmake jshint\n\n### Unit Tests\n\n\tmake mocha\n\n### Integration Test\n\nAssumes a running q process on port 5000 with kdb+tick available in QHOME (`QHOME=~/q ~/q/m32/q -p 5000`). For the tls tests you will also need a running q process on port 6000 set up to require tls. Instructions for this can be found [here](https://code.kx.com/q/kb/ssl/). If you are using a self signed certificate you will also need to set the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0`.\n\n\tmake mochait\n\n### Circular depdendencies\n\n\tmake circular\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwittig%2Fnode-q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwittig%2Fnode-q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwittig%2Fnode-q/lists"}