A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/websockets/bufferutil below:

GitHub - websockets/bufferutil: WebSocket buffer utils

bufferutil is what makes ws fast. It provides some utilities to efficiently perform some operations such as masking and unmasking the data payload of WebSocket frames.

npm install bufferutil --save-optional

The --save-optional flag tells npm to save the package in your package.json under the optionalDependencies key.

The module exports two functions. To maximize performance, parameters are not validated. It is the caller's responsibility to ensure that they are correct.

bufferUtil.mask(source, mask, output, offset, length)

Masks a buffer using the given masking-key as specified by the WebSocket protocol.

'use strict';

const bufferUtil = require('bufferutil');
const crypto = require('crypto');

const source = crypto.randomBytes(10);
const mask = crypto.randomBytes(4);

bufferUtil.mask(source, mask, source, 0, source.length);
bufferUtil.unmask(buffer, mask)

Unmasks a buffer using the given masking-key as specified by the WebSocket protocol.

'use strict';

const bufferUtil = require('bufferutil');
const crypto = require('crypto');

const buffer = crypto.randomBytes(10);
const mask = crypto.randomBytes(4);

bufferUtil.unmask(buffer, mask);

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4