https://github.com/sindresorhus/buffer-equals
Node.js 0.12 buffer.equals() ponyfill
https://github.com/sindresorhus/buffer-equals
deprecated
Last synced: 25 days ago
JSON representation
Node.js 0.12 buffer.equals() ponyfill
- Host: GitHub
- URL: https://github.com/sindresorhus/buffer-equals
- Owner: sindresorhus
- License: mit
- Archived: true
- Created: 2015-05-01T12:26:37.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2021-01-23T08:25:22.000Z (almost 5 years ago)
- Last Synced: 2024-10-29T22:38:21.946Z (about 1 year ago)
- Topics: deprecated
- Language: JavaScript
- Size: 48.8 KB
- Stars: 6
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-nodejs-precise - buffer-equals - equals .svg?style=social&label=Star&maxAge=2592000?style=flat-square)]() | Node.js 0.12 <code>buffer.equals()</code> ponyfill. | (Packages / Polyfills Node.js)
- awesome-nodejs-cn - buffer-equals - Node.js 0.12 `buffer.equals()` ponyfill. (Number / Polyfills)
README
# buffer-equals [](https://travis-ci.org/sindresorhus/buffer-equals)
> Node.js [`buffer.equals()`](https://nodejs.org/api/buffer.html#buffer_buf_equals_otherbuffer) [ponyfill](https://ponyfill.com)
**Deprecated: Just use [`Buffer#equals()`](https://nodejs.org/api/buffer.html#buffer_buf_equals_otherbuffer). It has been available since Node.js 0.12.**
## Install
```
$ npm install --save buffer-equals
```
## Usage
```js
const bufferEquals = require('buffer-equals');
bufferEquals(new Buffer('foo'), new Buffer('foo'));
//=> true
bufferEquals(new Buffer('foo'), new Buffer('bar'));
//=> false
```
## API
See the [`buffer.equals()` docs](https://nodejs.org/api/buffer.html#buffer_buf_equals_otherbuffer).
The only difference is that you pass in the buffer as the first argument instead of calling the `.equals()` method on the buffer instance.
## Related
- [buffer-equals-constant](https://github.com/sindresorhus/buffer-equals-constant) - Check if two buffers have the same bytes in constant time
- [buf-compare](https://github.com/sindresorhus/buf-compare) - Node.js 0.12 `Buffer.compare()` ponyfill
- [buf-indexof](https://github.com/sindresorhus/buf-indexof) - Node.js 4.0 `buffer.indexOf()` ponyfill
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)