UNPKG

@creit.tech/stellar-wallets-kit

Version:
14 lines (13 loc) 512 B
// Copyright 2018-2025 the Deno authors. MIT license. export function detach(buffer, maxSize) { const originalSize = buffer.length; if (buffer.byteOffset) { const b = new Uint8Array(buffer.buffer); b.set(buffer); buffer = b.subarray(0, originalSize); } // deno-lint-ignore no-explicit-any buffer = new Uint8Array(buffer.buffer.transfer(maxSize)); buffer.set(buffer.subarray(0, originalSize), maxSize - originalSize); return [buffer, maxSize - originalSize]; }