Skip to content

Commit

Permalink
- Updates (#238)
Browse files Browse the repository at this point in the history
- Slight performance improvement
- Updated documentation
  • Loading branch information
KD0NKS committed Apr 6, 2024
1 parent c5d5c36 commit 10bc780
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ connection.on('data', (data: Buffer) => {
bufferedData += data.toString();
let msgs = bufferedData.split('\r\n');

if(!bufferedData.endsWith('\r\n')) {
bufferedData = msgs[msgs.length - 1];
msgs = msgs.slice(0, -1);
if(this._bufferedData.endsWith('\r\n')) {
this._bufferedData = '';
msgs = msgs.filter(msg => msg.trim() != ''); // This is trimming out any empty messages
} else {
bufferedData = '';
msgs = msgs.filter(msg => msg.trim() != '');
this._bufferedData = msgs.pop();
}

//...
Expand Down
27 changes: 12 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "afairhurst",
"license": "ISC",
"name": "js-aprs-is",
"version": "2.0.0",
"version": "2.0.1",
"lockfileVersion": 3,
"homepage": "https://github.com/KD0NKS/js-aprs-is",
"description": "NodeJs library for connecting to an APRS-IS server.",
Expand Down Expand Up @@ -42,11 +42,11 @@
"mocha": "^10.4.0",
"nyc": "^15.1.0",
"source-map-support": "^0.5.21",
"tsx": "^4.7.1",
"typescript": "^5.4.3"
"tsx": "^4.7.2",
"typescript": "^5.4.4"
},
"dependencies": {
"@types/node": "^20.12.2",
"@types/node": "^20.12.5",
"uuid": "^9.0.1"
},
"optionalDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/ISSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ export class ISSocket extends Socket {
this._bufferedData = '';
msgs = msgs.filter(msg => msg.trim() != ''); // This is trimming out any empty messages
} else {
this._bufferedData = msgs[msgs.length - 1];
msgs = msgs.slice(0, -1);
this._bufferedData = msgs.pop();
}

this.emitPackets(msgs);
Expand Down

0 comments on commit 10bc780

Please sign in to comment.