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.2.3 to 1.2.4

5

History.md
1.2.4 / 2015-12-04
==================
* fix `ArrayBuffer` encoding in base64 string
1.2.3 / 2015-11-28

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

48

lib/index.js

@@ -66,3 +66,4 @@ /**

} else if (packet.data && (packet.data.buffer || packet.data) instanceof ArrayBuffer) {
return encodeArrayBuffer(packet, supportsBinary, callback);
packet.data = arrayBufferToBuffer(packet.data);
return encodeBuffer(packet, supportsBinary, callback);
}

@@ -96,20 +97,2 @@

function encodeArrayBuffer(packet, supportsBinary, callback) {
var data = packet.data.buffer || packet.data;
if (!supportsBinary) {
return exports.encodeBase64Packet(packet, callback);
}
var contentArray = new Uint8Array(data);
var resultBuffer = new Buffer(1 + data.byteLength);
resultBuffer[0] = packets[packet.type];
for (var i = 0; i < contentArray.length; i++){
resultBuffer[i+1] = contentArray[i];
}
return callback(resultBuffer);
}
/**

@@ -123,9 +106,4 @@ * Encodes a packet with binary data in a base64 string

exports.encodeBase64Packet = function(packet, callback){
if (!Buffer.isBuffer(packet.data)) {
var buf = new Buffer(packet.data.byteLength);
for (var i = 0; i < buf.length; i++) {
buf[i] = packet.data[i];
}
packet.data = buf;
packet.data = arrayBufferToBuffer(packet.data);
}

@@ -371,2 +349,22 @@

/**
*
* Converts an ArrayBuffer to a Buffer
*
* @api private
*/
function arrayBufferToBuffer(data) {
// data is either an ArrayBuffer or ArrayBufferView.
var array = new Uint8Array(data.buffer || data);
var length = data.byteLength || data.length;
var offset = data.byteOffset || 0;
var buffer = new Buffer(length);
for (var i = 0; i < length; i++) {
buffer[i] = array[offset + i];
}
return buffer;
}
/**
* Encodes multiple messages (payload) as binary.

@@ -373,0 +371,0 @@ *

{
"name": "engine.io-parser",
"description": "Parser for the client for the realtime Engine",
"version": "1.2.3",
"version": "1.2.4",
"homepage": "https://github.com/Automattic/engine.io-parser",

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

Sorry, the diff of this file is not supported yet

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