# base-convert-int-array

> Converts arrays of integers from one base to another. Uses an O(N²) algorithm.

Latest version **1.0.1** (published 2018-09-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install base-convert-int-array
pnpm add base-convert-int-array
yarn add base-convert-int-array
bun add base-convert-int-array
```

## 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.1 |
| Published | 2018-09-13 |
| First published | 2018-09-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mark Wubben |
| Maintainers | novemberborn |
| Keywords | base62, base36, buffer, binary, conversion, base |

## Links

- npm: https://www.npmjs.com/package/base-convert-int-array
- Repository: https://github.com/novemberborn/base-convert-int-array
- Homepage: https://github.com/novemberborn/base-convert-int-array#readme
- Issues: https://github.com/novemberborn/base-convert-int-array/issues
- npm.io page: https://npm.io/package/base-convert-int-array

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M 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
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-09-13
- 1.0.0 — 2018-09-09

## README

# base-convert-int-array

Converts arrays of integers from one base to another. Uses an O(N²) algorithm.

## Installation

```console
$ npm install base-convert-int-array
```

## Usage

First, get an array of integers. For example when converting a value encoded in
base 36:

```js
const base36 = Array.from('jld2cyuq0000t3rmniod1foy', char => parseInt(char, 36))
// [ 19, 21, 13, 2, 12, 34, 30, 26, 0, 0, 0, 0, 29, 3, 27, 22, 23, 18, 24, 13, 1, 15, 24, 34 ]
```

Then, to convert to a byte array:

```js
const baseConvertIntArray = require('base-convert-int-array')
const bytes = baseConvertIntArray(base36, {from: 36, to: 256})
// [ 9, 49, 119, 149, 90, 234, 41, 165, 216, 81, 246, 78, 200, 6, 114, 178 ]
```

Which you could turn into a buffer:

```js
const buffer = Buffer.from(bytes)
```

You can specify a fixed length for the resulting array:

```js
const bytes = baseConvertIntArray(base36, {from: 36, to: 256, fixedLength: 16})
```

A `RangeError` will be thrown if the input requires more space than
`fixedLength` allows for.

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