# vindec

> VIN Decoder

Latest version **2.8.0** (published 2024-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install vindec
pnpm add vindec
yarn add vindec
bun add vindec
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.8.0 |
| Published | 2024-10-25 |
| First published | 2016-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 76 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Philip Smith |
| Maintainers | thephilip |
| Keywords | vin, decoder, validator |

## Links

- npm: https://www.npmjs.com/package/vindec
- Homepage: https://github.com/thephilip/vindec
- Issues: https://github.com/thephilip/vindec/issues
- npm.io page: https://npm.io/package/vindec

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^1.6.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.1.1
- [vindec-validator](https://npm.io/package/vindec-validator.md) ^1.1.3

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

- 2.8.0 (latest) — 2024-10-25
- 2.7.2 — 2019-08-08
- 2.7.1 — 2019-01-09
- 2.6.4 — 2019-01-09
- 2.6.3 — 2018-05-03
- 2.6.2 — 2018-05-03
- 2.6.0 — 2018-05-03
- 2.5.1 — 2018-05-03
- 2.5.0 — 2018-05-03
- 2.4.0 — 2018-05-03
- 2.3.0 — 2018-05-02
- 2.2.1 — 2018-05-02
- 2.2.0 — 2018-05-02
- 2.1.3 — 2017-02-10
- 2.1.2 — 2016-11-12
- … 9 more at https://npm.io/package/vindec/versions

## README

# vindec

## Node.js VIN decoding package

### Installation

[![NPM](https://nodei.co/npm/vindec.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/vindec/)

If you prefer the previous version of this module, please use `npm install vindec@1.1.1`.  The current version creates a constructor, but the functionality is the same.

### Usage

```javascript

const vindec = require('vindec');
console.log(`Valid: ${vindec.validate('YOURMOM')}`) // false
console.log(JSON.stringify(vindec.decode('meh'))) // { vin: 'meh', valid: false }

```

You may optionally add a callback as a second argument to decode for error checking as in the past, but it has been simplified and will always return an object.

### Information Decoded

```javascript
{ vin: '12345678901234567',
  valid: true,
  wmi: '123',
  vds: '5678',
  checkDigit: '9',
  vis: '01234567',
  region: 'Somewhere Around Here',
  make: 'UFO',
  year: '1776',
  sequence_id: '234567' }
```

### NHTSA API Calls

Fetches the vehicle information from the NHTSA api. As a bonus, there is an opportunity to utilize the error responses from their api to provide better error handling to vindec in the future.

#### NHTSA API Documentation
You may read the official [NHTSA API documentaiton site](https://vpic.nhtsa.dot.gov/api/). Additionally, if you're feeling squirrelly and want to hit other endpoints, feel free to modify `./lib/nhtsa.js` to your liking, I may add/change somethings here in the future, be forewarned.

#### Usage (test)

```javascript

  const vin = '1G1BC53X76F123456' // example
  const vindec = new Vindec()

  vindec.nhtsa(vin).then(res => {
    console.log(res.data)
  }).catch(err => {
    console.error(err)
  })
  ```

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