<commit_before>Beanstalkd Client for Node.js
=============================

Version: 0.3.0

Example:

```js
var bs = require('node-beanstalkd')
  , client = new bs.Client();

client.connect('127.0.0.1:11300', function(err, conn) {
  var job_data = {"data": {"name": "node-beanstalkd"}};
  conn.put(0, 0, 1, JSON.stringify(job_data), function(err, job_id) {
    console.log('put job: ' + job_id);

    conn.reserve(function(err, job_id, job_json) {
      console.log('got job: ' + job_id);
      console.log('got job data: ' + job_json);
      console.log('module name is ' + JSON.parse(job_json).data.name);
      conn.destroy(job_id, function(err) {
        console.log('destroyed job');
      });
    });

  });
});
```


Try it:

    $ node test/test.js
<commit_msg>update readme with more flushed out example<commit_after>Beanstalkd Client for Node.js
=============================

Library to produce and consumer jobs for the [beanstalkd](http://kr.github.io/beanstalkd/) work queue. This is a fork of [node-beanstalk-client](https://github.com/benlund/node-beanstalk-client).

Version: 0.3.0

Basic example producing one job and consuming one job:

```js
var bs = require('node-beanstalkd')
  , client = new bs.Client();

client.connect('127.0.0.1:11300', function (err, conn) {
  if(err) {
    console.log('Error connecting to beanstalkd.');
    console.log('Make sure that beanstalkd is running.');
  } else {
    var data = {
      data: {
        name: "node-beanstalkd"
      }
    };
    conn.put(0, 0, 1, JSON.stringify(data), function (err, id) {
      if(err) {
        console.log('Error putting job.');
      } else {
        console.log('Produced Job ' + id);
        conn.reserve(function (err, id, json) {
          if(err) {
            console.log('Error reserving job.');
          } else {
            console.log('Consumed Job ' + id);
            console.log('Job Data: ' + json);
            console.log('Name: ' + JSON.parse(json).data.name);
            conn.destroy(id, function (err) {
              if(err) {
                console.log('Error destroying job.');
              } else {
                console.log('Destroyed Job');
                conn.end();
              }
            });
          }
        });
      }
    });
  }
});
```


Try it:

    $ node test/test.js

{'fraction_non_alphanumeric': 0.18122837370242215, 'fraction_numerical': 0.014705882352941176, 'mean_word_length': 2.371720116618076, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5542265', 'n_tokens_mistral': 786, 'n_tokens_neox': 740, 'n_words': 166}