Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stdlib/array-uint8

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/array-uint8

Uint8Array.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
337K
decreased by-6.18%
Maintainers
0
Weekly downloads
 
Created

What is @stdlib/array-uint8?

@stdlib/array-uint8 is a package that provides utilities for creating and manipulating unsigned 8-bit integer arrays (Uint8Array). It is part of the larger @stdlib library, which is a collection of standard libraries for JavaScript and Node.js.

What are @stdlib/array-uint8's main functionalities?

Creating a Uint8Array

This feature allows you to create a Uint8Array from an array of numbers. The resulting array is an instance of Uint8Array.

const uint8Array = require('@stdlib/array-uint8');
const arr = uint8Array([1, 2, 3, 4]);
console.log(arr); // Uint8Array [ 1, 2, 3, 4 ]

Accessing elements

You can access elements of the Uint8Array using standard array indexing.

const uint8Array = require('@stdlib/array-uint8');
const arr = uint8Array([1, 2, 3, 4]);
console.log(arr[0]); // 1
console.log(arr[1]); // 2

Modifying elements

This feature allows you to modify elements of the Uint8Array by directly setting values at specific indices.

const uint8Array = require('@stdlib/array-uint8');
const arr = uint8Array([1, 2, 3, 4]);
arr[0] = 10;
console.log(arr); // Uint8Array [ 10, 2, 3, 4 ]

Iterating over elements

You can iterate over the elements of the Uint8Array using a for...of loop.

const uint8Array = require('@stdlib/array-uint8');
const arr = uint8Array([1, 2, 3, 4]);
for (const value of arr) {
  console.log(value);
}
// 1
// 2
// 3
// 4

Other packages similar to @stdlib/array-uint8

Keywords

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc