<commit_before># Aerospike Node.js Client

An Aerospike add-on module for Node.js.

This module is compatible with Node.js 0.10.x and supports the following operating systems: CentOS/RHEL 6.x, Debian 6+, Ubuntu 12.04, Ubuntu 14.04, Mac OS X.

- [Usage](#Usage)
- [Prerequisites](#Prerequisites)
- [Installation](#Installation)
  - [Primer on Node.js Modules](#Primer-on-Node.js-Modules)
  - [Installing via NPM Registry](#Installing-via-NPM-Registry)
  - [Installing via Git Repository](#Installing-via-Git-Repository)
  - [C Client Resolution](#C-Client-Resolution)
    - [Force Download](#Force-Download)
    - [Custom Search Path](#Custom-Search-Path)
- [Tests](#Tests)
- [Examples](#Examples)
- [Benchmarks](#Benchmarks)
- [API Documentaion](#API-Documentation)

<a name="Usage"></a>
## Usage

The following is very simple example of how to write and read a record from Aerospike. 

```js
var aerospike = require('aerospike');
var status = aerospike.status;


// Connect to the cluster.
var client = aerospike.client({
    hosts: [ { addr: '127.0.0.1', port: 3000 } ]
});

function connect_cb( err, client) {
    if (err.code == status.AEROSPIKE_OK) {
        console.log("Aerospike Connection Success")
    }
}

client.connect(connect_cb)

// The key of the record we are reading.
var key = aerospike.key('test','demo','foo');

// Read the record from the database
client.get(key, function(err, rec, meta) {
    
    // Check for errors
    if ( err.code == status.AEROSPIKE_OK ) {
    	// The record was successfully read.
    	console.log(rec, meta);
    }
    else {
        // An error occurred
        console.error('error:', err);
    }
});
```

More examples illustrating the use of the API are located in the 
[`examples`](examples) directory. 

Details about the API are available in the [`docs`](docs) directory.

<a name="Prerequisites"></a>
## Prerequisites

[Node.js](http://nodejs.org) version v0.10.x is required. 

To install the latest stable version of Node.js, visit 
[http://nodejs.org/download/](http://nodejs.org/download/)

Aerospike Node.js has a dependency on Aerospike C client, which is
downloaded during the installation.  To Download Aerospike C client, curl is required.
The client library requires the following libraries to be present on the machine for building and running.

| Library Name | .rpm Package | Description |
| --- | --- | --- |<commit_msg>Updated the ReadMe with v0.12.x compatibility. Updated the example in the readme.<commit_after># Aerospike Node.js Client

An Aerospike add-on module for Node.js.

This module is compatible with Node.js v0.10.x and v0.12.x, and supports the following operating systems: CentOS/RHEL 6.x, Debian 6+, Ubuntu 12.04, Ubuntu 14.04, Mac OS X.

- [Usage](#Usage)
- [Prerequisites](#Prerequisites)
- [Installation](#Installation)
  - [Primer on Node.js Modules](#Primer-on-Node.js-Modules)
  - [Installing via NPM Registry](#Installing-via-NPM-Registry)
  - [Installing via Git Repository](#Installing-via-Git-Repository)
  - [C Client Resolution](#C-Client-Resolution)
    - [Force Download](#Force-Download)
    - [Custom Search Path](#Custom-Search-Path)
- [Tests](#Tests)
- [Examples](#Examples)
- [Benchmarks](#Benchmarks)
- [API Documentaion](#API-Documentation)

<a name="Usage"></a>
## Usage

The following is very simple example of how to write and read a record from Aerospike. 

```js
var aerospike = require('aerospike');
var status = aerospike.status;


// Connect to the cluster.
var client = aerospike.client({
    hosts: [ { addr: '127.0.0.1', port: 3000 } ]
});

function connect_cb( err, client) {
    if (err.code == status.AEROSPIKE_OK) {
        console.log("Aerospike Connection Success")
    }
}

client.connect(connect_cb)

// The key of the record we are reading.
var key = aerospike.key('test','demo','foo');

// write a record to database.
client.put(key, bins, metadata, function(err, key){

	// Read the same record from database
	client.get(key, function(err, rec, meta) {
    
		// Check for errors
		if ( err.code == status.AEROSPIKE_OK ) {
			// The record was successfully read.
			console.log(rec, meta);
		}
		else {
			// An error occurred
			console.error('error:', err);
		}
	});
});
```

More examples illustrating the use of the API are located in the 
[`examples`](examples) directory. 

Details about the API are available in the [`docs`](docs) directory.

<a name="Prerequisites"></a>
## Prerequisites

[Node.js](http://nodejs.org) version v0.10.x is required. 

To install the latest stable version of Node.js, visit 
[http://nodejs.org/download/](http://nodejs.org/download/)

Aerospike Node.js has a dependency on Aerospike C client, which is
downloaded during the installation.  To Download Aerospike C client, curl is required.
The client library requires the following libraries to be present on the machine for building and running.

| Library Name | .rpm Package | Description |
| --- | --- | --- |
{'fraction_non_alphanumeric': 0.13584752635847527, 'fraction_numerical': 0.011759935117599351, 'mean_word_length': 3.725095785440613, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3415259', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1530, 'n_words': 499}