Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method Buffer.prototype.writeIntLE
import { Buffer } from "https://deno.land/std@0.162.0/node/buffer.ts";

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

import { Buffer } from 'buffer';

const buf = Buffer.allocUnsafe(6);

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

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

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.