# @web3-storage/car-block-validator

> Validate car block bytes

Latest version **1.2.2** (published 2025-03-03) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @web3-storage/car-block-validator
pnpm add @web3-storage/car-block-validator
yarn add @web3-storage/car-block-validator
bun add @web3-storage/car-block-validator
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2025-03-03 |
| First published | 2023-03-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vasco Santos |
| Maintainers | alanshaw, it-dag-house, fforbeck |
| Keywords | ipld, block |

## Links

- npm: https://www.npmjs.com/package/@web3-storage/car-block-validator
- Repository: https://github.com/web3-storage/car-block-validator
- Homepage: https://github.com/web3-storage/car-block-validator#readme
- Issues: https://github.com/web3-storage/car-block-validator/issues
- npm.io page: https://npm.io/package/@web3-storage/car-block-validator

## Dependencies (5)

- [uint8arrays](https://npm.io/package/uint8arrays.md) ^5.1.0
- [multiformats](https://npm.io/package/multiformats.md) ^13.3.1
- [@multiformats/sha3](https://npm.io/package/@multiformats/sha3.md) ^3.0.2
- [@multiformats/blake2](https://npm.io/package/@multiformats/blake2.md) ^2.0.2
- [@multiformats/murmur3](https://npm.io/package/@multiformats/murmur3.md) ^2.1.8

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2025-03-03
- 1.2.1 — 2025-02-10
- 1.2.0 — 2023-05-09
- 1.1.0 — 2023-05-08
- 1.0.1 — 2023-03-10
- 1.0.0 — 2023-03-10

## README

# car-block-validator

> Validate car block bytes with web3.storage supported codecs

[![Build](https://github.com/web3-storage/car-block-validator/actions/workflows/main.yml/badge.svg)](https://github.com/web3-storage/car-block-validator/actions/workflows/main.yml)

`car-block-validator` validates [@ipld/car](https://github.com/ipld/js-car) blocks for the given hashers:

| hashes                                                                                                                          | import                         | repo                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `sha2-256`, `sha2-512`                                                                                                          | `multiformats/hashes/sha2`     | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes)             |
| `sha3-224`, `sha3-256`, `sha3-384`,`sha3-512`, `shake-128`, `shake-256`, `keccak-224`, `keccak-256`, `keccak-384`, `keccak-512` | `@multiformats/sha3`           | [multiformats/js-sha3](https://github.com/multiformats/js-sha3)                                                    |
| `identity`                                                                                                                      | `multiformats/hashes/identity` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes/identity.js) |
| `murmur3-128`, `murmur3-32`                                                                                                     | `@multiformats/murmur3`        | [multiformats/js-murmur3](https://github.com/multiformats/js-murmur3)                                              |
| `blake2b-*`, `blake2s-*`                                                                                                        | `@multiformats/blake2`         | [multiformats/js-blake2](https://github.com/multiformats/js-blake2)                                                |

## Install

```sh
# install it as a dependency
$ npm i @web3-storage/car-block-validator
```

## Usage

```js
import { validateBlock } from '@web3-storage/car-block-validator'

// Read CAR file as wished
// const inStream = fs.createReadStream(process.argv[2])
// const reader = await CarBlockIterator.fromIterable(inStream)

for await (const block of reader) {
  await validateBlock(block)
  // throws if not valid, either unknown codec or not valid bytes
}
```

---
_Source: https://npm.io/package/@web3-storage/car-block-validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
