### Installation via npm Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Command to install the package using npm. ```console $ npm i uint8arraylist ``` -------------------------------- ### Basic Usage of Uint8ArrayList Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Demonstrates appending data, consuming bytes, and iterating over the internal buffers. ```javascript import { Uint8ArrayList } from 'uint8arraylist' const list = new Uint8ArrayList() list.append(Uint8Array.from([0, 1, 2])) list.append(Uint8Array.from([3, 4, 5])) list.subarray() // -> Uint8Array([0, 1, 2, 3, 4, 5]) list.consume(3) list.subarray() // -> Uint8Array([3, 4, 5]) // you can also iterate over the list for (const buf of list) { // ..do something with `buf` } list.subarray(0, 1) // -> Uint8Array([0]) ``` -------------------------------- ### Browser Script Tag Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Loading the module via a script tag for browser usage. ```html ``` -------------------------------- ### Sublist Operations Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Creates a new Uint8ArrayList that shares underlying buffers, ensuring no-copy operations. ```javascript const list = new Uint8ArrayList() list.append(Uint8Array.from([0, 1, 2])) list.append(Uint8Array.from([3, 4, 5])) list.sublist(0, 1) // -> Uint8ArrayList([0]) - no-copy list.sublist(2, 5) // -> Uint8ArrayList([2], [3, 4]) - no-copy ``` -------------------------------- ### Slicing Uint8ArrayList Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Creates a new Uint8Array by copying bytes from the list. ```javascript const list = new Uint8ArrayList() list.append(Uint8Array.from([0, 1, 2])) list.append(Uint8Array.from([3, 4, 5])) list.slice(0, 1) // -> Uint8Array([0]) ``` -------------------------------- ### Subarray Operations Source: https://github.com/achingbrain/uint8arraylist/blob/main/README.md Performs a no-copy operation unless the requested range spans multiple internal buffers. ```javascript const list = new Uint8ArrayList() list.append(Uint8Array.from([0, 1, 2])) list.append(Uint8Array.from([3, 4, 5])) list.subarray(0, 1) // -> Uint8Array([0]) - no-copy list.subarray(2, 5) // -> Uint8Array([2, 3, 4]) - copy ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.