![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
varintes
Advanced tools
Readme
Encode and decode numbers per unsigned-varint specification, exposed as pure ES Module.
It is fast: 1.5x - 10x times faster than original varint
module.
We started this package as an ES Module version of varint
package.
Then we added few helpers used by existing varint package consumers.
npm install varintes
To encode a number as varint use encode
function:
import * as varintes from "varintes";
const bytes = varintes.encode(4242); // Uint8Array(2) [ 146, 33 ]
To decode varint from bytes, use decode
function. It returns decoded number, and amount of bytes read to decode.
The bytes read number may be used to continue decoding of a long bytes sequence.
import * as varintes from "varintes";
const [number, bytesRead] = varintes.decode(new Uint8Array([146, 33])); // number = 4242, bytesRead = 2
encodingLength
gives you length in bytes of a number when encoded as varint:
import * as varintes from "varintes";
const length = varintes.encodingLength(4242); // 2
Let's call tight packing of varints an encoding where varints' bytes follow each other.
There are two functions for tight packing and unpacking provided - encodePach
and decodePack
:
import * as varintes from "varintes";
const packed = varintes.encodePack([1, 17, 4242]); // Uint8Array(4) [ 1, 17, 146, 33 ]
const unpacked = varintes.decodePack(packed); // [1, 17, 4242]
MIT or APACHE-2.0
FAQs
Unsigned Varint encoding and decoding, exposed as ESModule
The npm package varintes receives a total of 2,067 weekly downloads. As such, varintes popularity was classified as popular.
We found that varintes 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
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.