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

bufferutil

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufferutil - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

LICENSE

55

fallback.js

@@ -1,3 +0,1 @@

'use strict';
/*!

@@ -9,7 +7,9 @@ * bufferutil: WebSocket buffer utils

module.exports.BufferUtil = {
merge: function(mergedBuffer, buffers) {
for (var i = 0, offset = 0, l = buffers.length; i < l; ++i) {
'use strict';
exports.BufferUtil = {
merge: function (mergedBuffer, buffers) {
var offset = 0;
for (var i = 0, l = buffers.length; i < l; ++i) {
var buf = buffers[i];
buf.copy(mergedBuffer, offset);

@@ -19,41 +19,14 @@ offset += buf.length;

},
mask: function(source, mask, output, offset, length) {
var maskNum = mask.readUInt32LE(0, true)
, i = 0
, num;
for (; i < length - 3; i += 4) {
num = maskNum ^ source.readUInt32LE(i, true);
if (num < 0) num = 4294967296 + num;
output.writeUInt32LE(num, offset + i, true);
mask: function (source, mask, output, offset, length) {
for (var i = 0; i < length; i++) {
output[offset + i] = source[i] ^ mask[i & 3];
}
switch (length % 4) {
case 3: output[offset + i + 2] = source[i + 2] ^ mask[2];
case 2: output[offset + i + 1] = source[i + 1] ^ mask[1];
case 1: output[offset + i] = source[i] ^ mask[0];
}
},
unmask: function(data, mask) {
var maskNum = mask.readUInt32LE(0, true)
, length = data.length
, i = 0
, num;
for (; i < length - 3; i += 4) {
num = maskNum ^ data.readUInt32LE(i, true);
if (num < 0) num = 4294967296 + num;
data.writeUInt32LE(num, i, true);
unmask: function (data, mask) {
// required until https://github.com/nodejs/node/issues/9006 is resolved
var length = data.length;
for (var i = 0; i < length; i++) {
data[i] ^= mask[i & 3];
}
switch (length % 4) {
case 3: data[i + 2] = data[i + 2] ^ mask[2];
case 2: data[i + 1] = data[i + 1] ^ mask[1];
case 1: data[i] = data[i] ^ mask[0];
}
}
};
{
"name": "bufferutil",
"version": "1.2.1",
"version": "1.3.0",
"description": "WebSocket buffer utils",
"main": "index.js",
"scripts": {
"test": "echo \"Only testing builds, test have to be extraced from `ws`\" && exit 0"
"test": "echo \"Only testing builds, tests have to be extraced from ws\""
},

@@ -23,5 +23,5 @@ "repository": {

"dependencies": {
"bindings": "1.2.x",
"nan": "^2.0.5"
"bindings": "~1.2.1",
"nan": "~2.4.0"
}
}
# bufferutil
[![Build Status](https://travis-ci.org/websockets/bufferutil.svg?branch=master)](https://travis-ci.org/websockets/bufferutil)
[![Version npm](https://img.shields.io/npm/v/bufferutil.svg)](https://www.npmjs.com/package/bufferutil)
[![Linux/macOS Build](https://travis-ci.org/websockets/bufferutil.svg?branch=master)](https://travis-ci.org/websockets/bufferutil)
[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/bufferutil?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/bufferutil)

@@ -13,3 +15,3 @@ Buffer utils is one of the modules that makes `ws` fast. It's optimized for

repository. See `fallback.js` for the suggest fallback implementation if
installation fails.
installation fails.

@@ -63,2 +65,2 @@ ## Installation

MIT
[MIT](LICENSE)

Sorry, the diff of this file is not supported yet

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