+5
-2
@@ -5,6 +5,9 @@ language: node_js | ||
| - "0.10" | ||
| - "0.11" | ||
| - "0.12" | ||
| - "4" | ||
| - "5" | ||
| - "6" | ||
| - "8" | ||
| - "10" | ||
| - "12" | ||
| - "13" | ||
| env: | ||
@@ -11,0 +14,0 @@ - CXX=g++-4.8 |
+13
-3
@@ -165,7 +165,7 @@ /// <reference types="node" /> | ||
| */ | ||
| host: string; | ||
| host?: string; | ||
| /** | ||
| * The port on the KDB host to connect to. | ||
| */ | ||
| port: number; | ||
| port?: number; | ||
| /** | ||
@@ -204,2 +204,6 @@ * Optional - The user to authenticate as to KDB. | ||
| long2number?: boolean; | ||
| /** | ||
| * Connect with Unix Domain Sockets rather than TCP | ||
| */ | ||
| unixSocket?: string; | ||
| } | ||
@@ -221,3 +225,3 @@ | ||
| /** | ||
| * Attempt to connect to aKDB instance using the specified host, port, username and password, and return the connection when it is established. | ||
| * Attempt to connect to a KDB instance using the specified host, port, username and password, and return the connection when it is established. | ||
| * @param host The KDB host to connect to. | ||
@@ -231,4 +235,10 @@ * @param port The port on the host to connect to. | ||
| /** | ||
| * Attempt to connect to KDB using Unix Domain Sockets, and return the connection when it is established. | ||
| * @param unixSocket Path to KDB Unix Domain Socket (Doesn't support abstract namespace sockets: KDB3.5+ on Linux) | ||
| * @param callback Callback to be invoked when the connection is (or fails to be) established. | ||
| */ | ||
| export declare function connect(unixSocket: string, callback: AsyncValueCallback<Connection>): void; | ||
| /** | ||
| * Brings in the Typed wrapper APIs. | ||
| */ | ||
| export * from './lib/typed'; |
+19
-7
@@ -177,6 +177,9 @@ var libc = require("./lib/c.js"); | ||
| params = {}; | ||
| if (arguments.length === 3) { | ||
| if (arguments.length === 2) { | ||
| params.unixSocket = arguments[0]; | ||
| cb = arguments[1]; | ||
| } else if (arguments.length === 3) { | ||
| params.host = arguments[0]; | ||
| params.port = arguments[1]; | ||
| cb = arguments[arguments.length -1]; | ||
| cb = arguments[2]; | ||
| } else if (arguments.length === 5) { | ||
@@ -187,10 +190,10 @@ params.host = arguments[0]; | ||
| params.password = arguments[3]; | ||
| cb = arguments[arguments.length -1]; | ||
| cb = arguments[4]; | ||
| } else { | ||
| throw new Error("only three or five arguments allowed"); | ||
| throw new Error("only two, three or five arguments allowed"); | ||
| } | ||
| } | ||
| assert.object(params, "params"); | ||
| assert.string(params.host, "params.host"); | ||
| assert.number(params.port, "params.port"); | ||
| assert.optionalString(params.host, "params.host"); | ||
| assert.optionalNumber(params.port, "params.port"); | ||
| assert.optionalString(params.user, "params.user"); | ||
@@ -204,2 +207,3 @@ assert.optionalString(params.password, "password"); | ||
| assert.optionalBool(params.long2number, "params.long2number"); | ||
| assert.optionalString(params.unixSocket, "params.unixSocket"); | ||
| if (params.user !== undefined) { | ||
@@ -220,3 +224,10 @@ assert.string(params.password, "password"); | ||
| }; | ||
| socket = net.connect(params.port, params.host, function() { | ||
| var socketArgs = []; | ||
| if (params.unixSocket) { | ||
| socketArgs.push(params.unixSocket); | ||
| } | ||
| else { | ||
| socketArgs.push(params.port, params.host); | ||
| } | ||
| socketArgs.push(function() { | ||
| socket.removeListener("error", errorcb); | ||
@@ -234,2 +245,3 @@ if (error === false) { | ||
| }); | ||
| socket = net.connect.apply(null, socketArgs); | ||
| if (params.socketTimeout !== undefined) { | ||
@@ -236,0 +248,0 @@ socket.setTimeout(params.socketTimeout); |
+1
-1
| { | ||
| "name": "node-q", | ||
| "version": "2.4.4", | ||
| "version": "2.5.0", | ||
| "description": "Q interfacing with Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+13
-3
@@ -28,3 +28,3 @@ [](http://travis-ci.org/michaelwittig/node-q) | ||
| #### Create Connection with user and password auth | ||
| ### Create Connection with user and password auth | ||
@@ -40,2 +40,11 @@ ```javascript | ||
| ### Create Connection with Unix Domain Socket (Doesn't support abstract namespace sockets: KDB 3.5+ on Linux) | ||
| ```javascript | ||
| nodeq.connect({ unixSocket: "/path/to/socket" }, function(err, con) { | ||
| if (err) throw err; | ||
| console.log("connected"); | ||
| }); | ||
| ``` | ||
| ### Execute Q code and receive result | ||
@@ -265,4 +274,5 @@ | ||
| * `params`: Object | ||
| * `host`: String (e. g. "localhost") | ||
| * `port`: Number (e. g. 5000) | ||
| * `host`: String (e. g. "localhost") (optional) | ||
| * `port`: Number (e. g. 5000) (optional) | ||
| * `unixSocket`: String (e. g. "/path/to/socket") (optional) | ||
| * `user`: String (optional) | ||
@@ -269,0 +279,0 @@ * `password`: String (optional) |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
173131
0.69%4663
0.47%382
2.69%