coap-packet
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -34,8 +34,13 @@ | ||
, i | ||
, length | ||
packet = fillGenDefaults(packet) | ||
options = prepareOptions(packet) | ||
length = calculateLength(packet, options) | ||
buffer = new Buffer(calculateLength(packet, options)) | ||
if (length > 1280) | ||
throw new Error('Max packet size is 1280: current is ' + length) | ||
buffer = new Buffer(length) | ||
// first byte | ||
@@ -42,0 +47,0 @@ byte = 0 |
{ | ||
"name": "coap-packet", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Generate and Parse CoAP packets", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,4 +20,6 @@ CoAP-Packet | ||
This has been tested only on node v0.8. | ||
**CoAP-packet** is an **OPEN Open Source Project**, see the <a href="#contributing">Contributing</a> section to find out what this means. | ||
This has been tested only on node v0.10. | ||
## Installation | ||
@@ -63,2 +65,3 @@ | ||
<a name="parse"></a> | ||
### parse(buffer) | ||
@@ -69,2 +72,3 @@ | ||
<a name="generate"></a> | ||
### generate() | ||
@@ -76,2 +80,3 @@ | ||
<a name="format"></a> | ||
### JS packet format | ||
@@ -99,2 +104,11 @@ | ||
<a name="contributing"></a> | ||
## Contributing | ||
__CoAP-Packet__ is an **OPEN Open Source Project**. This means that: | ||
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. | ||
See the [CONTRIBUTING.md](https://github.com/mcollina/coap-packet/blob/master/CONTRIBUTING.md) file for more details. | ||
## Contributors | ||
@@ -101,0 +115,0 @@ |
@@ -676,6 +676,5 @@ | ||
it('should generate a payload', function() { | ||
payload = new Buffer(42) | ||
buffer = generate({ payload: payload }) | ||
expect(buffer.slice(5)).to.eql(payload) | ||
it('should error if the resulting message is greater than 1280', function() { | ||
payload = new Buffer(1280 - 4) // the basic headers are 4 | ||
expect(generate.bind(null, { payload: payload })).to.throw('Max packet size is 1280: current is 1281') | ||
}) | ||
@@ -682,0 +681,0 @@ |
Sorry, the diff of this file is not supported yet
spdx disjunction for an artifact's license information
Licensespdx disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
spdx disjunction for an artifact's license information
Licensespdx disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
2
100
1090
123
44887
9