<commit_before># HarperDB Node.JS Driver

## Created by <NAME>

After cloning project navigate to [HarperDB](http://products.harperdb.io/download/beta) and download the appropriate beta version.

Decompress download and copy the `HarperDB` folder do this project directory.

Run `npm run init` to generate HarperDB Database and generate your environment variables for authorization.

**Note** I highly recommend you set the DB path to `Path/To/This/Directory/hdb`
This will help contain any test queries you may run while testing the driver.

Template .env file
```env
HARPERDB_USERNAME=[USERNAME]
HARPERDB_PASSWORD=[PASSWORD]
```

Want to test out the driver?

Run `npm run start-harperDB` and then `npm run example-fastify`

Then navigate to localhost:3000/list_users in your browser, and you should be greeted with a response from the server containing data from the database.
<commit_msg>Adding documentation for Event Emitters<commit_after># HarperDB Node.JS Driver

## Created by <NAME>

After cloning project navigate to [HarperDB](http://products.harperdb.io/download/beta) and download the appropriate beta version.

Decompress download and copy the `HarperDB` folder do this project directory.

Run `npm run init` to generate HarperDB Database and generate your environment variables for authorization.

**Note** I highly recommend you set the DB path to `Path/To/This/Directory/hdb`
This will help contain any test queries you may run while testing the driver.

Template .env file
```env
HARPERDB_USERNAME=[USERNAME]
HARPERDB_PASSWORD=[PASSWORD]
```

Want to test out the driver?

Run `npm run start-harperDB` and then `npm run example-fastify`

Then navigate to localhost:3000/list_users in your browser, and you should be greeted with a response from the server containing data from the database.


## Documentation

### Event Emitters
The HarperDB Driver class is hooked up to a standard Node.JS core event emitter. From any server file you can add event hooks such as:

```javascript
const db = new HarperDB();
db.event.on('connection', () => console.log('CONNECTED'));
```

Currently available events are as follows:
`request`, `connection`, `error`

{'fraction_non_alphanumeric': 0.07756232686980609, 'fraction_numerical': 0.003693444136657433, 'mean_word_length': 5.104225352112676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2154446', 'n_tokens_mistral': 608, 'n_tokens_neox': 577, 'n_words': 276}