Skip to content

Commit

Permalink
Merge pull request #28 from aj-ptw/master
Browse files Browse the repository at this point in the history
FIX: Buffer problems
  • Loading branch information
AJ Keller authored Mar 13, 2018
2 parents 88b0bca + f929d9d commit 12f7859
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.3.4

### Bug Fixes

* Protect and ensure buffer returned for raw data packets

# v0.3.3

### Enhancements
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
Provide a stable javascript library for OpenBCI
</p>

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

## Welcome!
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openbci-utilities",
"version": "0.3.3",
"version": "0.3.4",
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.",
"main": "dist/openbci-utilities.js",
"module": "src/index.js",
Expand Down
7 changes: 5 additions & 2 deletions src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ let utilitiesModule = {
// Overwrite the dataBuffer with a new buffer
let tempBuf;
if (parsePosition > 0) {
tempBuf = Buffer.concat([dataBuffer.slice(0, parsePosition), dataBuffer.slice(parsePosition + k.OBCIPacketSize)], dataBuffer.byteLength - k.OBCIPacketSize);
tempBuf = Buffer.concat([
Buffer.from(dataBuffer.slice(0, parsePosition)),
Buffer.from(dataBuffer.slice(parsePosition + k.OBCIPacketSize))
]);
} else {
tempBuf = dataBuffer.slice(k.OBCIPacketSize);
tempBuf = Buffer.from(dataBuffer.slice(k.OBCIPacketSize));
}
if (tempBuf.length === 0) {
dataBuffer = null;
Expand Down

0 comments on commit 12f7859

Please sign in to comment.