Node.js
buffer.equals()
ponyfill
Deprecated: Just use Buffer#equals()
. It has been available since Node.js 0.12.
$ npm install --save buffer-equals
const bufferEquals = require('buffer-equals');
bufferEquals(new Buffer('foo'), new Buffer('foo'));
//=> true
bufferEquals(new Buffer('foo'), new Buffer('bar'));
//=> false
See the buffer.equals()
docs.
The only difference is that you pass in the buffer as the first argument instead of calling the .equals()
method on the buffer instance.
- buffer-equals-constant - Check if two buffers have the same bytes in constant time
- buf-compare - Node.js 0.12
Buffer.compare()
ponyfill - buf-indexof - Node.js 4.0
buffer.indexOf()
ponyfill
MIT © Sindre Sorhus