Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/io/slice_long_to_bytes.ts

Deno standard library
Go to Latest
File
// Copyright 2018-2023 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 Web Streams instead. */export function sliceLongToBytes( d: number, dest = Array.from<number>({ length: 8 }),): number[] { let big = BigInt(d); for (let i = 0; i < 8; i++) { dest[7 - i] = Number(big & 0xffn); big >>= 8n; } return dest;}