array-buffer-byte-length <sup>Version Badge</sup>

github actions coverage License Downloads

npm badge

Get the byte length of an ArrayBuffer, even in engines without a .byteLength method.

Example

const assert = require('assert');
const byteLength = require('array-buffer-byte-length');

assert.equal(byteLength([]), NaN, 'an array is not an ArrayBuffer, yields NaN');

assert.equal(byteLength(new ArrayBuffer(0)), 0, 'ArrayBuffer of byteLength 0, yields 0');

Tests

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

array-buffer-byte-length - Installation

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

n

NPM

npm install array-buffer-byte-length --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install array-buffer-byte-length

Learn more about the config option.

PNPM

pnpm install array-buffer-byte-length --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install array-buffer-byte-length --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.

array-buffer-byte-length - Download

Download Tarball (v1.0.2)

Integrity sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==
SHASUM 384d12a37295aec3769ab022ad323a18a51ccf8b
Tarball https://js.registry.sudovanilla.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz