1. array-buffer-byte-length
Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.
array-buffer-byte-length
Package: array-buffer-byte-length
Created by: inspect-js
Last modified: Sat, 03 Feb 2024 23:32:02 GMT
Version: 1.0.1
License: MIT
Downloads: 98,067,110
Repository: https://github.com/inspect-js/array-buffer-byte-length

Install

npm install array-buffer-byte-length
yarn add array-buffer-byte-length

array-buffer-byte-length Version Badge

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code