Go to Latest
method Buffer.prototype.writeIntBE
import { Buffer } from "https://dotland.deno.dev/std@0.177.0/node/buffer.ts";

Writes byteLength bytes of value to buf at the specified offsetas big-endian. Supports up to 48 bits of accuracy. Behavior is undefined whenvalue is anything other than a signed integer.

import { Buffer } from 'buffer';

const buf = Buffer.allocUnsafe(6);

buf.writeIntBE(0x1234567890ab, 0, 6);

console.log(buf);
// Prints: <Buffer 12 34 56 78 90 ab>

Parameters

value: number

Number to be written to buf.

offset: number

Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength.

byteLength: number

Number of bytes to write. Must satisfy 0 < byteLength <= 6.

Returns

number

offset plus the number of bytes written.