![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@webassemblyjs/leb128
Advanced tools
The @webassemblyjs/leb128 package is a utility library for encoding and decoding LEB128 (Little Endian Base 128) values. LEB128 is a variable-length encoding for arbitrary-precision integers, commonly used in the WebAssembly binary format. This package provides functions to read and write both signed and unsigned LEB128 integers.
Decode unsigned LEB128
This feature allows you to decode an unsigned LEB128 integer from a buffer. The provided code sample demonstrates how to decode a buffer containing an unsigned LEB128 encoded integer.
const { decodeU32 } = require('@webassemblyjs/leb128');
const buffer = Buffer.from([0xe5, 0x8e, 0x26]);
const result = decodeU32(buffer); // result is 624485
Decode signed LEB128
This feature allows you to decode a signed LEB128 integer from a buffer. The provided code sample demonstrates how to decode a buffer containing a signed LEB128 encoded integer.
const { decodeS32 } = require('@webassemblyjs/leb128');
const buffer = Buffer.from([0x9b, 0xf1, 0x59]);
const result = decodeS32(buffer); // result is -624485
Encode unsigned LEB128
This feature allows you to encode an unsigned integer into LEB128 format. The provided code sample demonstrates how to encode a JavaScript number into an unsigned LEB128 buffer.
const { encodeU32 } = require('@webassemblyjs/leb128');
const value = 624485;
const buffer = encodeU32(value); // buffer is <Buffer e5 8e 26>
Encode signed LEB128
This feature allows you to encode a signed integer into LEB128 format. The provided code sample demonstrates how to encode a JavaScript number into a signed LEB128 buffer.
const { encodeS32 } = require('@webassemblyjs/leb128');
const value = -624485;
const buffer = encodeS32(value); // buffer is <Buffer 9b f1 59>
The 'leb' package is another npm package that provides similar functionality for encoding and decoding LEB128 values. It also supports both signed and unsigned integers, and it can be used in similar contexts as @webassemblyjs/leb128.
The 'varint' package is used for encoding and decoding variable-length integers using a different encoding scheme than LEB128, but it serves a similar purpose in terms of representing integers in a compact form. It is commonly used in protocols like Protocol Buffers and is an alternative to LEB128 for certain use cases.
FAQs
LEB128 decoder and encoder
The npm package @webassemblyjs/leb128 receives a total of 8,867,997 weekly downloads. As such, @webassemblyjs/leb128 popularity was classified as popular.
We found that @webassemblyjs/leb128 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.