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

geteventstore-client

v0.1.6

Published

Client for talking to GetEventStore using the AtomPub over HTTP interface

Downloads

11

Readme

geteventstore-client

Client for talking to GetEventStore using the AtomPub interface over HTTP

Support

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

Quick example

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);
    });
  }
});

Install

npm install geteventstore-client

createClient(options)

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.

client.write(streamName, data, eventType, callback)

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 signature function (err) where:
    • err - Any error that may have occurred during the handling of the request.

client.readFirst(streamName, callback)

Reads the latest item added to the stream.

  • streamName - A string specifying the stream name.
  • callback - Called when the function completes using the signature function (err, data) where:
    • err - Any error that may have occurred during the handling of the request.
    • data - The object that was stored last.

client.readLast(streamName, callback)

Reads the first item added to the stream.

  • streamName - A string specifying the stream name.
  • callback - Called when the function completes using the signature function (err, data) where:
    • err - Any error that may have occurred during the handling of the request.
    • data - The original object stored in the stream.

client.readPrevious(streamName, callback)

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 signature function (err, data) where:
    • err - Any error that may have occurred during the handling of the request.
    • data - The object stored at the the position.

client.readNext(streamName, callback)

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 signature function (err, data) where:
    • err - Any error that may have occurred during the handling of the request.
    • data - The object stored at the position.

client.deleteStream(streamName, hardDelete, callback)

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 signature function (err) where:
    • err - Any error that may have occurred during the handling of the request.

Test

npm test