Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/buffer-equals
Node.js 0.12 buffer.equals() ponyfill
https://github.com/sindresorhus/buffer-equals
deprecated
Last synced: 10 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 9 years ago)
- Default Branch: main
- Last Pushed: 2021-01-23T08:25:22.000Z (about 4 years ago)
- Last Synced: 2024-10-29T22:38:21.946Z (3 months 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
README
# buffer-equals [![Build Status](https://travis-ci.org/sindresorhus/buffer-equals.svg?branch=master)](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'));
//=> truebufferEquals(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)