# to-data-view

> Create a `DataView` over an `ArrayBuffer`/8-bit typed array (commonly used in the browsers) or a `Buffer` (commonly used in Node.js).

Latest version **2.0.0** (published 2021-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install to-data-view
pnpm add to-data-view
yarn add to-data-view
bun add to-data-view
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-07-24 |
| First published | 2018-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | linusu |

## Links

- npm: https://www.npmjs.com/package/to-data-view
- Repository: https://github.com/LinusU/to-data-view
- Homepage: https://github.com/LinusU/to-data-view#readme
- Issues: https://github.com/LinusU/to-data-view/issues
- npm.io page: https://npm.io/package/to-data-view

## Recent versions

- 2.0.0 (latest) — 2021-07-24
- 1.1.0 — 2019-11-16
- 1.0.0 — 2018-01-27

## README

# To DataView

Create a `DataView` over an `ArrayBuffer`/8-bit typed array (commonly used in the browsers) or a `Buffer` (commonly used in Node.js).

Supported inputs:

- [`ArrayBuffer`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
- [`Buffer`](https://nodejs.org/docs/latest/api/buffer.html#buffer_class_buffer)
- [`Int8Array`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Int8Array)
- [`Uint8Array`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
- [`Uint8ClampedArray`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray)

## Installation

```sh
npm install --save to-data-view
```

## Usage

```js
import toDataView from 'to-data-view'

// This function will accept both `ArrayBuffer` and `Buffer` as input
function awesomeParser (source) {
  const view = toDataView(source)

  // ...
}
```

## API

### `toDataView(data)`

- `data` (`ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray`, required)
- returns `DataView`

Return a `DataView` instance that uses the same memory as the provided `ArrayBuffer`, 8-bit typed array or `Buffer`.

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