Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io-parser

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-parser - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

5

History.md
1.0.6 / 2014-05-30
==================
* utf8 fixes when using binary encoding [nkzawa]
1.0.5 / 2014-05-06

@@ -3,0 +8,0 @@ ==================

36

lib/index.js

@@ -332,2 +332,32 @@ /**

/**
*
* Converts a buffer to a utf8.js encoded string
*
* @api private
*/
function bufferToString(buffer) {
var str = '';
for (var i = 0; i < buffer.length; i++) {
str += String.fromCharCode(buffer[i]);
}
return str;
}
/**
*
* Converts a utf8.js encoded string to a buffer
*
* @api private
*/
function stringToBuffer(string) {
var buf = new Buffer(string.length);
for (var i = 0; i < string.length; i++) {
buf.writeUInt8(string.charCodeAt(i), i);
}
return buf;
}
/**
* Encodes multiple messages (payload) as binary.

@@ -355,3 +385,3 @@ *

if (typeof packet === 'string') {
var encodingLength = '' + Buffer.byteLength(packet, "utf8");
var encodingLength = '' + packet.length;
var sizeBuffer = new Buffer(encodingLength.length + 2);

@@ -363,3 +393,3 @@ sizeBuffer[0] = 0; // is a string (not true binary = 0)

sizeBuffer[sizeBuffer.length - 1] = 255;
return doneCallback(null, Buffer.concat([sizeBuffer, new Buffer(packet, 'binary')]));
return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)]));
}

@@ -413,3 +443,3 @@

var msg = bufferTail.slice(1, msgLength + 1);
if (isString) msg = msg.toString('binary');
if (isString) msg = bufferToString(msg);
buffers.push(msg);

@@ -416,0 +446,0 @@ bufferTail = bufferTail.slice(msgLength + 1);

2

package.json
{
"name": "engine.io-parser",
"description": "Parser for the client for the realtime Engine",
"version": "1.0.5",
"version": "1.0.6",
"homepage": "https://github.com/LearnBoost/engine.io-protocol",

@@ -6,0 +6,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc