# arraybuffer-to-string

> Convert ArrayBuffer to string

Latest version **1.0.2** (published 2018-02-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install arraybuffer-to-string
pnpm add arraybuffer-to-string
yarn add arraybuffer-to-string
bun add arraybuffer-to-string
```

## 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.2 |
| Published | 2018-02-23 |
| First published | 2017-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Dima Yv |
| Maintainers | dfcreative |
| Keywords | arraybuffer, array-buffer, array, buffer, string, base64, atob, btoa, datauri |

## Links

- npm: https://www.npmjs.com/package/arraybuffer-to-string
- Repository: https://github.com/dfcreative/arraybuffer-to-string
- Homepage: https://github.com/dfcreative/arraybuffer-to-string#readme
- Issues: https://github.com/dfcreative/arraybuffer-to-string/issues
- npm.io page: https://npm.io/package/arraybuffer-to-string

## 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.2 (latest) — 2018-02-23
- 1.0.1 — 2017-06-27
- 1.0.0 — 2017-06-27

## README

# arraybuffer-to-string [![unstable](https://img.shields.io/badge/stability-unstable-orange.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dfcreative/arraybuffer-to-string.svg)](https://travis-ci.org/dfcreative/arraybuffer-to-string)

Convert _ArrayBuffer_ to string with optional encoding.

[![npm install arraybuffer-to-string](https://nodei.co/npm/arraybuffer-to-string.png?mini=true)](https://npmjs.org/package/arraybuffer-to-string/)

```js
var ab2str = require('arraybuffer-to-string')

var uint8 = new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])

ab2str(uint8) // 'Hello World!'
ab2str(uint8, 'base64') // 'SGVsbG8gV29ybGQh'
ab2str(uint8, 'hex') // '48656c6c6f20576f726c6421'
ab2str(uint8, 'iso-8859-2') // 'Hello World!'
```

### var str = arrayBufferToString(buffer, encoding='utf8')

Convert ArrayBuffer/ArrayBufferView/Array `buffer` to string with defined encoding. Available encoding: `utf8`, `binary`, `base64`, `hex`, `ascii`, `latin1`, `ucs2`, `utf16` and [many others](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding).

Note: in browser it relies on [TextDecoder API](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode), so if you are dealing with charsets other than `utf8`, `ascii`, `binary` or `base64` in old browsers, please include [encoding polyfill](https://github.com/inexorabletash/text-encoding).

### Related

* [string-to-arraybuffer](https://github.com/dfcreative/string-to-arraybuffer) − convert string to arraybuffer.
* [create-data-uri](https://www.npmjs.com/package/create-data-uri) − convert binary data to datauri string.

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