# clz-buffer

> Count leading zeros in a Buffer (clz)

Latest version **1.0.0** (published 2017-11-16) · ISC license · 0 weekly downloads

## Install

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

## 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 | 2017-11-16 |
| First published | 2017-11-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Emil Bay |
| Maintainers | emilbayes |
| Keywords | clz, nlz, leading, zeros, buffer, uint8array, typedarray, array |

## Links

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

## 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

- 1.0.0 (latest) — 2017-11-16

## README

# `clz-buffer`

[![Build Status](https://travis-ci.org/emilbayes/clz-buffer.svg?branch=master)](https://travis-ci.org/emilbayes/clz-buffer)

> Count leading zeros in a Buffer (clz)

## Usage

```js
var clz = require('clz-buffer')

clz([0b00001000]) // === 4
clz([0b10000000]) // === 0
clz([0b10000000, 0]) // === 0
clz([0, 0]) // === 16
clz(Buffer.from([0, 0, 0])) // === 24
```

## API

### `var n = clz(buf)`

Counts the number of leading zeros. Stops at the first 1-bit. Works for any
array-like type with values in the domain `[0, 255]`.

## Install

```sh
npm install clz-buffer
```

## License

[ISC](LICENSE)

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