import { chunk } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/bytes/index.js";
Breaks the byte array into smaller chunks according to the given length.
Examples
Example 1
Example 1
import { chunk } from "@ayonli/jsext/bytes";
const arr = new Uint8Array([1, 2, 3, 4, 5, 6, 7]);
console.log(chunk(arr, 3));
// [
// Uint8Array(3) [ 1, 2, 3 ],
// Uint8Array(3) [ 4, 5, 6 ],
// Uint8Array(1) [ 7 ]
// ]