Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/uint8array/index.ts>copy

A JavaScript extension package for building strong and modern applications.
Latest
function copy
import { copy } from "https://deno.land/x/ayonli_jsext@v0.9.72/uint8array/index.ts";

Copies bytes from src array to dest and returns the number of bytes copied.

Examples

Example 1

import { copy } from "@ayonli/jsext/bytes";

const src = new Uint8Array([1, 2, 3, 4, 5]);
const dest = new Uint8Array(3);

const n = copy(src, dest);

console.log(n); // 3
console.log(dest); // Uint8Array(3) [ 1, 2, 3 ]

Parameters

src: Uint8Array
dest: Uint8Array

Returns

number