# mqtt-nedb-store

> Store your in-flight mqtt packets in nedb

Latest version **0.1.1** (published 2019-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install mqtt-nedb-store
pnpm add mqtt-nedb-store
yarn add mqtt-nedb-store
bun add mqtt-nedb-store
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-06-28 |
| First published | 2017-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Behrad Zari |
| Maintainers | behrad |
| Keywords | mqtt, nedb, store |

## Links

- npm: https://www.npmjs.com/package/mqtt-nedb-store
- Repository: https://github.com/behrad/mqtt-nedb-store
- Homepage: https://github.com/behrad/mqtt-nedb-store#readme
- Issues: https://github.com/behrad/mqtt-nedb-store/issues
- npm.io page: https://npm.io/package/mqtt-nedb-store

## Dependencies (2)

- [nedb](https://npm.io/package/nedb.md) ^1.8.0
- [msgpack5](https://npm.io/package/msgpack5.md) ^3.4.1

## Recent versions

- 0.1.1 (latest) — 2019-06-28
- 0.1.0 — 2017-05-30

## README

# MQTT.js NeDB Store

NeDB Store for in-flight MQTT.js packets. Thanks to [nedb](https://github.com/louischatriot/nedb).

## Usage

```js
'use strict';

var mqtt = require('mqtt'),
  NeDBStore = require('mqtt-nedb-store'),
  manager = NeDBStore('path/to/db');

var client = mqtt.connect({
  port: 8883,
  incomingStore: manager.incoming,
  outgoingStore: manager.outgoing
});

//// or
// var client = mqtt.connect('mqtt://test.mosca.io', {
//  port: 8883,
//  incomingStore: manager.incoming,
//  outgoingStore: manager.outgoing
//});

client.on('connect', function() {
  console.log('connected');
  client.publish('hello', 'world', {qos: 1}, function() {
    console.log('published');
    client.end();
  });
});
```

## Automatic compaction

NeDB datastores are compacted by default only when opened. NeDB's automatic
periodic compaction can be activated with NeDB constructor options:

```
  manager = NeDBStore('path/to/db', { outgoing: { autocompactionInterval: 60 } });
```



## License

MIT

---
_Source: https://npm.io/package/mqtt-nedb-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
