# lorapacket

> LoRa WAN packet encode / decoder

Latest version **1.0.1** (published 2017-11-21) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install lorapacket
pnpm add lorapacket
yarn add lorapacket
bun add lorapacket
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-11-21 |
| First published | 2017-11-21 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Alexandru Radovici |
| Maintainers | alexandruradovici |
| Keywords | lora, lorawan, packet, encode, decoder |

## Links

- npm: https://www.npmjs.com/package/lorapacket
- Repository: https://github.com/loralai-server/LoRaPacket
- Homepage: https://github.com/loralai-server/LoRaPacket#readme
- Issues: https://github.com/loralai-server/LoRaPacket/issues
- npm.io page: https://npm.io/package/lorapacket

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [extend](https://npm.io/package/extend.md) ^3.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [validator](https://npm.io/package/validator.md) ^9.1.1
- [node-aes-cmac](https://npm.io/package/node-aes-cmac.md) ^0.1.1

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-11-21
- 1.0.0 — 2017-11-21

## README

# LoRaPacket
LoRa WAN Packet decoder / encoder. For the moment it implements the LoRa WAN v1.0.2 standard.

## Install

    npm install lorapacket

## Usage

Here are a few usage examples, for more please use the full [documentation](DOCUMENTATION.md).

### Decode data (buffer or string)
````javascript
var LoRaPacket = require ('lorapacket');

var nwkSKey = getNwkSKey ();
var appSKey = getAppSKey ();

// from Buffer
var bufferData = getPacketBuffer ();

var packet = new LoRaPacket (bufferData, {
    nwkSKey,
    appSKey,
    encoding: 'hex'
});

// from String
var bufferData = getPacketString ();

var packet = new LoRaPacket (bufferData, {
    nwkSKey,
    appSKey,
    encoding: 'hex'
},
{
    encoding: 'base64'
});
````

### Encode data 
````javascript
var LoRaPacket = require ('lorapacket');

var nwkSKey = getNwkSKey ();
var appSKey = getAppSKey ();

var packet = new LoRaPacket ({
        mtype: LoRaPacket.MTYPE.MTYPE_UNCONFIRMEWD_DOWNLINK,
        devAddr: '010A020A',
        fCtrl:
        {
            adr: 0),
            adrAckReq: 0,
            ack: 0,
            pending: 0,
            fOptsLen: 0
        },
        fCnt: 1,
        fPort: 2,
        frmPayload: new Buffer ('packet buffer')
    }, {
        nwkSKey,
        appSKey,
        encoding: 'hex'
    }
    );
````


&copy; 2017 Wyliodrin SRL

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