# is-buffer-zero

> Checks if a buffer only consist of zeros

Latest version **1.0.0** (published 2022-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-buffer-zero
pnpm add is-buffer-zero
yarn add is-buffer-zero
bun add is-buffer-zero
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-03-15 |
| First published | 2022-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anders Rune Jensen |
| Maintainers | arj03 |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2022-03-15

## README

# is-buffer-zero

A fork of mafintosh [is-zero-buffer] that performs better when buffer
is not empty.

## benchmark.js:

```
Benchmarking 10.000 0 buffers:
is-buffer-zero: 42 ms
is-zero-buffer: 38 ms
is zero using loop: 10285 ms

Benchmarking 100.000 random buffers:
is-buffer-zero: 25 ms
is-zero-buffer: 71 ms
is zero using loop: 26 ms
```

## API

### `isZero(buffer, peekLength)`

Returns true if a buffer only contains `0`s, false
otherwise. `peekLength` is used to check the first bytes of a buffer
using a loop, this can be faster if buffer is not empty. Defaults to
8.

## License

MIT

[is-zero-buffer]: https://github.com/mafintosh/is-zero-buffer

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