UNPKG

@oazmi/build-tools

Version:

general deno build tool scripts which I practically use in all of my typescript repos

18 lines (17 loc) 609 B
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. /** * Slice number into 64bit big endian byte array * @param d The number to be sliced * @param dest The sliced array * * @deprecated (will be removed after 1.0.0) Use the {@link https://developer.mozilla.org/en-US/docs/Web/API/Streams_API | Web Streams API} instead. */ export function sliceLongToBytes(d, dest = Array.from({ length: 8 })) { let big = BigInt(d); for (let i = 0; i < 8; i++) { dest[7 - i] = Number(big & 0xffn); big >>= 8n; } return dest; }