Skip to content

Commit 12f7859

Browse files
author
AJ Keller
authored
Merge pull request #28 from aj-ptw/master
FIX: Buffer problems
2 parents 88b0bca + f929d9d commit 12f7859

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v0.3.4
2+
3+
### Bug Fixes
4+
5+
* Protect and ensure buffer returned for raw data packets
6+
17
# v0.3.3
28

39
### Enhancements

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
Provide a stable javascript library for OpenBCI
88
</p>
99

10-
[![Build Status](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS_Utilities.svg?branch=master)](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS_Utilities)
11-
[![codecov](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS_Utilities/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS_Utilities)
12-
[![Dependency Status](https://david-dm.org/OpenBCI/OpenBCI_NodeJS_Utilities.svg)](https://david-dm.org/OpenBCI/OpenBCI_NodeJS_Utilities)
13-
[![npm](https://img.shields.io/npm/dm/openbci-ganglion.svg?maxAge=2592000)](http://npmjs.com/package/openbci-utilities)
10+
[![Build Status](https://travis-ci.org/OpenBCI/OpenBCI_JavaScript_Utilities.svg?branch=master)](https://travis-ci.org/OpenBCI/OpenBCI_JavaScript_Utilities)
11+
[![codecov](https://codecov.io/gh/OpenBCI/OpenBCI_Javascript_Utilities/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenBCI/OpenBCI_Javascript_Utilities)
12+
[![Dependency Status](https://david-dm.org/OpenBCI/OpenBCI_Javascript_Utilities.svg)](https://david-dm.org/OpenBCI/OpenBCI_Javascript_Utilities)
13+
[![npm](https://img.shields.io/npm/dm/openbci-utilities.svg?maxAge=2592000)](http://npmjs.com/package/openbci-utilities)
1414
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard)
1515

1616
## Welcome!

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openbci-utilities",
3-
"version": "0.3.3",
3+
"version": "0.3.4",
44
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.",
55
"main": "dist/openbci-utilities.js",
66
"module": "src/index.js",

src/utilities.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ let utilitiesModule = {
9898
// Overwrite the dataBuffer with a new buffer
9999
let tempBuf;
100100
if (parsePosition > 0) {
101-
tempBuf = Buffer.concat([dataBuffer.slice(0, parsePosition), dataBuffer.slice(parsePosition + k.OBCIPacketSize)], dataBuffer.byteLength - k.OBCIPacketSize);
101+
tempBuf = Buffer.concat([
102+
Buffer.from(dataBuffer.slice(0, parsePosition)),
103+
Buffer.from(dataBuffer.slice(parsePosition + k.OBCIPacketSize))
104+
]);
102105
} else {
103-
tempBuf = dataBuffer.slice(k.OBCIPacketSize);
106+
tempBuf = Buffer.from(dataBuffer.slice(k.OBCIPacketSize));
104107
}
105108
if (tempBuf.length === 0) {
106109
dataBuffer = null;

0 commit comments

Comments
 (0)