data-view-buffer <sup>Version Badge</sup>

github actions coverage License Downloads

npm badge

Get the ArrayBuffer out of a DataView, robustly.

This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property. It will also work in modern engines where DataView.prototype.buffer has been deleted after this module has loaded.

Example

const dataViewBuffer = require('data-view-buffer');
const assert = require('assert');

const ab = new ArrayBuffer(0);
const dv = new DataView(ab);
assert.equal(dataViewBuffer(dv), ab);

Tests

Simply clone the repo, npm install, and run npm test

data-view-buffer - Installation

To install data-view-buffer via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install data-view-buffer --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install data-view-buffer

Learn more about the config option.

PNPM

pnpm install data-view-buffer --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install data-view-buffer --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

data-view-buffer - Download

Download Tarball (v1.0.2)

Integrity sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==
SHASUM 211a03ba95ecaf7798a8c7198d79536211f88570
Tarball https://js.registry.sudovanilla.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz