is-zero-buffer

Check is a buffer only contains 0s

MIT License

Downloads
29
Stars
15

is-zero-buffer

Check is a buffer only contains 0s

npm install is-zero-buffer

Uses buffer.compare to be as fast as possible (~20x faster than checking all bytes in a loop)

Usage

var isZero = require('is-zero-buffer')

console.log(isZero(someBuffer)) // returns true is someBuffer only contains 0s

API

var bool = isZero(buffer)

Returns true if a buffer only contains 0s, false otherwise.

License

MIT