# buffer-equals

> Node.js 0.12 buffer.equals() ponyfill

Latest version **2.0.0** (published 2018-09-24) · MIT license · 0 weekly downloads

> **Deprecated.** See documentation for alternatives

> **Better alternative:** See documentation for alternatives (https://github.com/AikidoSec/module-replacements/blob/main/docs/buffer-equals)

## Install

```sh
npm install buffer-equals
pnpm add buffer-equals
yarn add buffer-equals
bun add buffer-equals
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-09-24 |
| First published | 2015-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | builtin, core, ponyfill, polyfill, shim, buffer, buffers, equals, equal, compare, comparison |

## Links

- npm: https://www.npmjs.com/package/buffer-equals
- Repository: https://github.com/sindresorhus/buffer-equals
- Homepage: https://github.com/sindresorhus/buffer-equals#readme
- Issues: https://github.com/sindresorhus/buffer-equals/issues
- npm.io page: https://npm.io/package/buffer-equals

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-09-24
- 1.0.4 — 2016-09-30
- 1.0.3 — 2015-05-09
- 1.0.2 — 2015-05-07
- 1.0.1 — 2015-05-02

## 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'));
//=> 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)

---
_Source: https://npm.io/package/buffer-equals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
