If you're using this module, feel free to contact me on twitter if you have any questions! :) @colmharte
Tested on: Node 0.10.38
var gesClient = require('geteventstore-client');
var client = gesClient.createClient({host: 'localhost', port: 2113});
client.write("teststream", {testing: true, otherdata: "some data"}, "changed", function(err){
if (err)
console.log("Something failed " + err);
else {
client.readFirst("teststream", function(err, data){
console.log(data);
});
}
});
npm install geteventstore-client
Creates a client object.
options
- Object specifying the connectioon details.- host: host name of the server. Defaults to localhost.
- port: port to use. Defaults to 2113
- ssl: true to connect over ssl. Defaults to false
- rejectUnauthorized: false to disable rejecting unauthorized requests based on the validity of ssl certs. Defaults to true.
- timeout: Timeout for calls, Defaults to 5 seconds.
- maxDataSize: The maximum data size sent to a stream. Defaults to 1048576 (1mb).
- maxCacheSize: The number of objects to cache locally to speed up retrieval. Defaults to 1000.
Writes an item into a stream. A stream will automatically be created if this is the first time an object has been written to it.
streamName
- A string specifying the stream name.data
- An object to be stored.eventType
- The event type to record when writing this object to the stream.callback
- Called when the function completes using the signaturefunction (err)
where:err
- Any error that may have occurred during the handling of the request.
Reads the latest item added to the stream.
streamName
- A string specifying the stream name.callback
- Called when the function completes using the signaturefunction (err, data)
where:err
- Any error that may have occurred during the handling of the request.data
- The object that was stored last.
Reads the first item added to the stream.
streamName
- A string specifying the stream name.callback
- Called when the function completes using the signaturefunction (err, data)
where:err
- Any error that may have occurred during the handling of the request.data
- The original object stored in the stream.
Reads the next newest item from the current position. The starting position can be set by calling readFirst or readLast.
streamName
- A string specifying the stream name.callback
- Called when the function completes using the signaturefunction (err, data)
where:err
- Any error that may have occurred during the handling of the request.data
- The object stored at the the position.
Reads the previous older item from the current position. The starting position can be set by calling readFirst or readLast.
streamName
- A string specifying the stream name.callback
- Called when the function completes using the signaturefunction (err, data)
where:err
- Any error that may have occurred during the handling of the request.data
- The object stored at the position.
Deletes a stream.
streamName
- A string specifying the stream name.hardDelete
- Set to true to permanently delete the stream.callback
- Called when the function completes using the signaturefunction (err)
where:err
- Any error that may have occurred during the handling of the request.
npm test