# buf-compare

> Node.js `Buffer.compare()` 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/buf-compare)

## Install

```sh
npm install buf-compare
pnpm add buf-compare
yarn add buf-compare
bun add buf-compare
```

## Health

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

Negative: deprecated.

## Facts

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

## Links

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

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M 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
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-09-24
- 1.0.1 — 2016-09-30
- 1.0.0 — 2015-05-09

## README

# Deprecated

Just use [`Buffer.compare()`](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_compare_buf1_buf2). It has been available since Node.js 0.12.

---

# buf-compare [![Build Status](https://travis-ci.org/sindresorhus/buf-compare.svg?branch=master)](https://travis-ci.org/sindresorhus/buf-compare)

> Node.js [`Buffer.compare()`](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_compare_buf1_buf2) [ponyfill](https://ponyfill.com)


## Install

```
$ npm install --save buf-compare
```


## Usage

```js
var bufCompare = require('buf-compare');

bufCompare(new Buffer('a'), new Buffer('a'));
//=> 0

bufCompare(new Buffer('a'), new Buffer('b'));
//=> -1
```


## API

See the [`Buffer.compare()` docs](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_compare_buf1_buf2).


## Related

- [buffer-equals](https://github.com/sindresorhus/buffer-equals) - Node.js `buffer.equals()` ponyfill
- [buf-indexof](https://github.com/sindresorhus/buf-indexof) - Node.js `buffer.indexOf()` ponyfill


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)

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