data-view-byte-offset <sup>Version Badge</sup>

github actions coverage License Downloads

npm badge

Get the byteOffset 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.byteOffset has been deleted after this module has loaded.

Example

const dataViewByteOffset = require('data-view-byte-offset');
const assert = require('assert');

const ab = new ArrayBuffer(42);
const dv = new DataView(ab, 2);
assert.equal(dataViewByteOffset(dv), 2);

Tests

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

data-view-byte-offset - Installation

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

n

NPM

npm install data-view-byte-offset --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-byte-offset

Learn more about the config option.

PNPM

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

Learn more about the --registry parameter.

Bun Logo

Bun

bun install data-view-byte-offset --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-byte-offset - Download

Download Tarball (v1.0.1)

Integrity sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==
SHASUM 068307f9b71ab76dbbe10291389e020856606191
Tarball https://js.registry.sudovanilla.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz